REOPENED300866
Adding a CSS class which changes an element's flex through an !important rule does not work
https://bugs.webkit.org/show_bug.cgi?id=300866
Summary Adding a CSS class which changes an element's flex through an !important rule...
Nige White
Reported 2025-10-15 23:30:37 PDT
Created attachment 477101 [details] Demonstrates the bug In the attached example the initial layout is as expected. Click the 'Add "measuring" class' button. This adds a class which has a rule which overrides all others and makes all rows flex : 0 0 16.6% !important There are six rows, so all rows should appear an equal height. There is no flex shrink or flex grow allowed, and the rule is !important and should override all normal rules. They do *not* appear at an equal height of 16.6% Click the "Show empty row's flex" button. It confirms that the computedStyle has the flex value as "0 0 max(16.666%, 0px)" But the layout is not correct. This works on Chrome and Firefox and Safari 18.
Attachments
Demonstrates the bug (4.21 KB, text/html)
2025-10-15 23:30 PDT, Nige White
no flags
rendering in safari, firefox, chrome (251.13 KB, image/png)
2025-10-16 01:38 PDT, Karl Dubost
no flags
Rendering on Safari 26 (81.77 KB, image/png)
2025-10-16 03:22 PDT, Nige White
no flags
iOS 26.1 iPad Screen Recording (2.15 MB, video/quicktime)
2026-01-08 10:24 PST, Sammy Gill
no flags
See the flexed row heights change as the mouse moves over an element. (765.59 KB, video/quicktime)
2026-01-14 01:06 PST, Nige White
no flags
Karl Dubost
Comment 1 2025-10-16 01:38:33 PDT
Created attachment 477102 [details] rendering in safari, firefox, chrome Thanks for the report.
Nige White
Comment 2 2025-10-16 03:21:07 PDT
(In reply to Karl Dubost from comment #1) > Created attachment 477102 [details] > rendering in safari, firefox, chrome > > Thanks for the report. That's Rendering on Safari 18 I see there. Try on an iPad which has been "up"graded to Safari 26
Nige White
Comment 3 2025-10-16 03:22:00 PDT
Created attachment 477103 [details] Rendering on Safari 26
Karl Dubost
Comment 4 2025-10-16 07:39:24 PDT
That was rendering on STP Release 230 (WebKit 21623.1.11.19.3) not Safari 18. :) More exactly Safari Technology Preview 230 / 26.0 21623.1.11.19.3 Firefox Nightly 145.0a1 14525.10.7 Google Chrome Canary 143.0.7475.0 7475.0
Karl Dubost
Comment 5 2025-10-16 07:42:31 PDT
but indeed it reproduces on iPad. and it goes back to normal after rotation.
Nige White
Comment 6 2025-10-19 00:47:05 PDT
I changed the priority to blocker. Ascertaining correct measurements is important. Our app will not work without the flexbox layout working properly.
Radar WebKit Bug Importer
Comment 7 2025-10-19 11:05:03 PDT
alan
Comment 8 2025-10-19 19:51:04 PDT
it has already progressed on trunk (300433@main)
alan
Comment 9 2025-10-19 19:51:32 PDT
*** This bug has been marked as a duplicate of bug 299372 ***
Nige White
Comment 10 2025-12-05 02:55:50 PST
When will the fix be released? I have had two updates of iOS on my iPad, and Safari still misrenders flexbox layouts. Safari 18, and all the non-iOS browsers lay out fine. Just the layout engine of 26 is broken. This is affecting our business. Flexbox has been around a long time. It has worked in Safari for a long time. How did you break it on version 26?
Nige White
Comment 11 2025-12-05 02:59:51 PST
Seems that this is not a duplicate of "Rendering issues" (Please use descriptive ticket names and descriptions)
Nige White
Comment 12 2025-12-20 05:45:55 PST
It works on Safari 26.1 on Mac. It is BROKEN on iPad.
Nige White
Comment 13 2026-01-04 03:26:41 PST
This is a TERRIBLE bug. Your flexbox implementation on iOS simply DOES. NOT. WORK. In the Safari debugger, the elements just change size seemingly randomly. When I mouseover them in the debugging window, they flip to a correct height.
Nige White
Comment 14 2026-01-07 22:16:01 PST
Are you doing anything about this bug? SOME feedback would be welcomed.
Sammy Gill
Comment 15 2026-01-08 10:24:44 PST
Created attachment 477936 [details] iOS 26.1 iPad Screen Recording Here is a screen recording of the test page on an iPad with iOS 26.1. This seems to be different from what we saw on iOS 26. Can you confirm if this is the behavior your are expecting or provide a screen recording with with you are seeing and with the device and OS you are using?
Nige White
Comment 16 2026-01-09 08:50:12 PST
You can run a test page for yourself to see how broken it is https://www.bryntum.com/products/calendar/examples/basic/ Go to the "Month" view. This view is of course a six row flexbox. One row for each week. Run it on Mac Safari it's fine. On Chrome it's fine, on FF it's fine. On iOS Safari you can't even pinpoint a failure. It's unstable. If you open it in the debugger, the element change size unpredictably as you select them in the DOM tab.
Nige White
Comment 17 2026-01-09 08:54:18 PST
Actually use https://www.bryntum.com/products/calendar/examples/basic/?screenshot The designers in their infinite wisdom place enormous margins round the demo Calendar which makes it a bad UX on an iPad. And will not hear a word said against it. Adding ?screenshot makes it fit the viewport for generating the thumbs you see in the examples landing page, and this is how I often run it on iPad.
Nige White
Comment 18 2026-01-14 00:48:37 PST
NOPE It is broken on MacOS too. A broken browser. Elements change height in an indeterminate manner while simply mouseovering a month view.
Nige White
Comment 19 2026-01-14 01:06:46 PST
Created attachment 478009 [details] See the flexed row heights change as the mouse moves over an element. getComputedStyle($0).flex On that row always returns `0 0 max(16.666667%, 59px)` We want to flex it to 1/6 height, but never drop below 59 high. It is *unable* to do this reliably.
Simon Fraser (smfr)
Comment 20 2026-01-14 09:32:56 PST
Nige, what macOS version are you testing on? Also, please test in the latest Safari Tech Preview.
Nige White
Comment 21 2026-01-14 10:26:03 PST
26.2. Latest update arrived yesterday. Just go to a month view in any Calendar example. It just WILL NOT obey the flexBasis of `max(16.666667%, 59px)` which is consistently applied to the row elements. The element sizes just flip around in a non-deterministic way as you examine the DOM debugger tab and poke around with styles.
Simon Fraser (smfr)
Comment 22 2026-01-15 10:46:20 PST
What about Safari Tech Preview (which will have more recent fixes)?
Nige White
Comment 23 2026-01-15 10:48:34 PST
I feel you are clutching at straws here rather than rolling your sleeves up!
Note You need to log in before you can comment on or make changes to this bug.