Upvote 1

Allow "Focus on" for Buttons and other elements that can receive focus

Completed Dave 6 years ago

Lots of elements in HTML can receive focus other than text inputs and textareas, as shown in this brief GIF showing focus moving from a textarea to a button:


When a non-text[area] focusable element receives focus, it should be possible to set some appearance properties, such as an outer glow (via shadow, perhaps).

Focusable elements, in the form of a CSS selector, include:

  • a[href]:not([tabindex='-1']),
  • area[href]:not([tabindex='-1']),
  • input:not([disabled]):not([tabindex='-1']),
  • select:not([disabled]):not([tabindex='-1']),
  • textarea:not([disabled]):not([tabindex='-1']),
  • button:not([disabled]):not([tabindex='-1']),
  • iframe:not([tabindex='-1']),
  • [tabindex]:not([tabindex='-1"]),
  • [contentEditable=true]:not([tabindex='-1'])

Replies (2)

Hi Dave,

Great suggestion! I have forwarded this to our development team.




Thank you, Danielle!

I posted it ages ago as a Question, but a commenter pointed out that it would be better as an Idea. I couldn't see a way to change my Question into an Idea, so I created a new one. Feel free to delete the Question, as it's fully covered here.

Leave a Comment
Attach a file