-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Description
While investigating euphorie/Euphorie#72 I found an interesting bug: the modal pattern is breaking the autofocus pattern. What happens is this:
- new HTML is injected
- the browser notices the autofocus attribute on an element and correctly gives that the focus
- injection triggers the patterns-injected event, which causes the registry to scan
- the registry invokes the autofocus pattern, which sets the focus again according to its own rules
- next the modal pattern is invoked, which wraps its content in a
div.panel-content
The DOM manipulation at the last step causes the input element to be removed and reinserted at a different place in the DOM, and the focus is lost at that point and reset to document.body.