Is there a css equivalent of pointer-events but for keyboard events?
Asked Answered
O

0

4

I am trying to make readonly, but not disable, all types of form element only using css and html (i.e. no javascript).

Some things (like inputs) are easy - the readonly attribute on the input does it. For other things, like checkboxes and selects for example, readonly doesn't work. I can use css pointer-events: none to prevent clicking on it, but I haven't found a keyboard-events: none or similar that I can use to stop people getting to it with the keyboard and changing it.

I know of several ways to achieve this with javascript, but I'm hoping to find one that is javascript free.

Olivo answered 20/8, 2022 at 17:53 Comment(1)
tabindex="-1" attributeBobbee

© 2022 - 2024 — McMap. All rights reserved.