Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Why am I having issues keyboard tabbing through an element thats positioned fixed on the page?

I know that positioning takes the element out of the natrual page flow. However, is there a way around this? As I need to be able to keyboard tab through my page.

Thanks

3 Answers

Steven Parker
Steven Parker
231,261 Points

Do you have some code to show?

Just using fixed position should not prevent a control from receiving focus by tabbing.

Reminder: only links and buttons can get focus by keyboard.

It's depends, if you open a fixed element it need to be after the button that's opening it, unless you use JS to focus the first element (that can get focus - links or buttons) in the "Dialog Box", and in when closing, you need to focus back to the open button.

If there is no focus-able tag in the "Dialog Box" you can add the "Dialog Box" attribute of tabindex="0" (give it the option of focus-able).

Gari Merrifield
Gari Merrifield
9,598 Points

Eva, I think you missed "form elements" in your list of things that can receive focus from the keyboard.

Thanks Gari, you right!