Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix dialog reappearing after hitting Enter #841

Merged
merged 1 commit into from
Apr 26, 2017
Merged

Conversation

lukebarnard1
Copy link
Contributor

Fixes element-hq/element-web#3714

element-hq/element-web#3714 (comment) :

It's as if there are two dialogs and as one closes, the other one appears. For some reason #822 is causing this.
I've realised it's because the priorActiveElement is probably the button that opened the dialog. If this is focused and the enter key is released, this triggers a keyPress which fires once the dialog has closed and the button has been focused 😬 the BaseDialog only calls stopPropagation _onKeyDown.

The soln. was to submit the dialog as finished onKeyUp. This means the priorActiveElement is focussed after any key events that should be associated with the dialog.

Fixes element-hq/element-web#3714

element-hq/element-web#3714 (comment) :
> It's as if there are two dialogs and as one closes, the other one appears. For some reason #822 is causing this.
> I've realised it's because the `priorActiveElement` is probably the button that opened the dialog. If this is focused and the enter key is released, this triggers a keyPress which fires once the dialog has closed and the button has been focused 😬 the BaseDialog only calls stopPropagation _onKeyDown.

The soln. was to submit the dialog as finished `onKeyUp`. This means the `priorActiveElement` is focussed after any key events that should be associated with the dialog.
@dbkr dbkr merged commit 1913a32 into develop Apr 26, 2017
dbkr added a commit that referenced this pull request May 16, 2017
dbkr added a commit that referenced this pull request May 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dialogs don't go away when using Enter instead of clicking the button
3 participants