Responsive DOM Manipulators
About this code
Usually, HTML code order and screen reader reading and tab order follow the same, expected path: Left to right, top to bottom.
Responsive CSS and Grid can visually move elements around with Flex order, Position Absolute, or Floats. With these visual changes, sometimes it's difficult to ensure the HTML/DOM/TAB order is properly reflected (without very specific JavaScript to deal with focus).
The code here changes that by moving DOM elements to different spots in the DOM based on breakpoint
Give it a try
Try tabbing through the area at different breakpoints. You'll see the tabbing order remains correct while the DOM changes significantly!
- 1
- 320
- 640
- 960
- 1280
HTML
Note: classes and empty divs omitted for simplicity
JavaScript