-
Notifications
You must be signed in to change notification settings - Fork 8
Description
By default, the autofocus is applied to the first focusable child of the element to which the modifier is attached to, as visible here: https://github.com/qonto/ember-autofocus-modifier/blob/master/ember-autofocus-modifier/src/modifiers/autofocus.js#L24
👉 Notice how
selector === DEFAULT_SELECTORby default: https://github.com/qonto/ember-autofocus-modifier/blob/master/ember-autofocus-modifier/src/modifiers/autofocus.js#L17
This beheavior isn't ideal, as we may want to check the element to which the autofocus modifier itself is attached to first.
Example
<details>
<summary {{autofocus}}>Napoleon surname <input type="text" /></summary>
<p>Bonaparte</p>
</details>Current behavior
With the current implementation, the focus would go to the input element, while focusing the summary element could be exactly what the user expected.
Expected behavior
The summary element should be the one focused, leaving the input unfocused.
Any thoughts about this?