fix(create-grid): correctly compute stack order for non-positioned stacking contexts#3930
fix(create-grid): correctly compute stack order for non-positioned stacking contexts#3930
Conversation
WilcoFiers
left a comment
There was a problem hiding this comment.
-
I tried to refactor this function a bit, in order to help myself understand it better, please use that: https://github.com/dequelabs/axe-core/pull/3932/files
-
I think we should move getStackingOrder into its own file. It's only tangentially related to creating the grid. I think separating these two could make things a little clearer.
Overall, I can't seem to keep this all straight in my head. I hope I didn't miss anything, but I'm not sure.
* chore: Refactor createStackingOrder * Remove magic numbers
I don't think we should. The reason being that if we did we'd have to add tests for it, which means testing stacking context arrays. Those would be a pain to maintain as doing something like we just did (refactoring magic numbers, adding a new stack where one wasn't before) would break all the tests. I'd much rather test actual stack results like we are doing in |
WilcoFiers
left a comment
There was a problem hiding this comment.
Would have preferred to see createStackingOrder move into its own file, but
While working on the code, I realized that the spec said that if any element that creates a stacking context it would remove the fake stacks created from float or positioned elements that use auto or 0 z-index. So I was able to merge those functions into a single if statement. I also simplified the loop to remove fake stacks so it only needs to look through the array and
spliceonce (since any new stack removes all previous fake stacks).Closes: #3929