Skip to content

Allow focused elements to retain focus when setting disabled attribute. - #13170

Draft
keithamus wants to merge 1 commit into
whatwg:mainfrom
keithamus:allow-focused-elements-to-retain-focus-when-setting-disabled-attribute
Draft

keithamus wants to merge 1 commit into
whatwg:mainfrom
keithamus:allow-focused-elements-to-retain-focus-when-setting-disabled-attribute

Conversation

@keithamus

@keithamus keithamus commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

This change prevents elements from being unfocused due to the disabled attribute being set. Losing focus on an element that gains disabled is a common UX issue.

In order to facilitate this change, controls with pickers (Date, Select, File) must close their open pickers. Controls also need to be updated to check their disabled status in order to close pickers and ignore key events while the disabled control is focused. Disabled controls cannot be focused into.

Fixes #13159

(See WHATWG Working Mode: Changes for more details.)


/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )
/input.html ( diff )
/interaction.html ( diff )
/webappapis.html ( diff )

This change prevents elements from being unfocused due to the `disabled`
attribute being set. Losing focus on an element that gains `disabled` is a
common UX issue.

In order to facilitate this change, controls with pickers (Date, Select, File)
must close their open pickers. Controls also need to be updated to check their
`actually disabled` status in order to close pickers and form controls must
ignore key events while the disabled control is focused. Disabled controls
cannot be focused into.

Fixes whatwg#13159

@dawoodkhan19402-cloud dawoodkhan19402-cloud left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/

@sb3nder

sb3nder commented Oct 31, 2026

Copy link
Copy Markdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants