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

Fixes 2 issues with Dialog closing #867

Merged
merged 4 commits into from
May 9, 2017
Merged

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented May 7, 2017

  • Upload Confirmation dialog would just change focus on ESC and not close
  • Keywords Dialog in UserSettings would also close UserSettings because event bubbled up

element-hq/element-web#1801 doesn't exist in /app/ yet does in /develop/ because of this

+ Upload Confirmation dialog would just change focus on ESC and not close
+ Keywords Dialog in UserSettings would also close UserSettings because event bubbled up
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@ara4n
Copy link
Member

ara4n commented May 7, 2017

unsure I understand the fix here; isn't this going to intercept and deny any keyboard activity in the dialog?

@t3chguy
Copy link
Member Author

t3chguy commented May 7, 2017

@ara4n and that is why thats my last commit today
/me goes to sleep

@ara4n
Copy link
Member

ara4n commented May 7, 2017

@lukebarnard1 i assume the onKeyDown() bit is yours - i don't follow the comment here; can you spell out precisely which bug & scenario switching from onKeyPress() to onKeyDown() fixes?

@lukebarnard1
Copy link
Contributor

lukebarnard1 commented May 8, 2017

So @t3chguy did a PR that after closing the dialog would refocus the thing that had focus prior to the dialog appearing #822. But because the shift of focus was happening onKeyDown and because the focused element was then getting the onKeyPressed/Up following that, another problem occured: element-hq/element-web#3714 (comment):

I've realised it's because the priorActiveElement is 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.

Resulting in every dialog affected appearing twice.

@t3chguy
Copy link
Member Author

t3chguy commented May 8, 2017

and now because Escape is not caught onKeyDown other things are free to catch it and act upon it

@lukebarnard1
Copy link
Contributor

It's a shame that BaseDialog has to worry about what could happen if onKey[Whatever] bubbles up. It would be much nicer if it could just absorb all of them whilst it's mounted without having to define a handler for each conceivable event.

@t3chguy
Copy link
Member Author

t3chguy commented May 9, 2017

@lukebarnard1 any nice ways of doing that?

@lukebarnard1
Copy link
Contributor

@t3chguy I talked it through with @dbkr and we can't think of a nicer way to do it other than absorbing all the key events (up, down, pressed) in the dialog. To prevent the inputs on the dialog from being broken, you should only call stopPropagation (not preventDefault).

so they don't trigger other things bubbling up
until Modal is closed
@t3chguy
Copy link
Member Author

t3chguy commented May 9, 2017

@lukebarnard1 ptal

@lukebarnard1 lukebarnard1 merged commit 3549ff2 into develop May 9, 2017
dbkr added a commit that referenced this pull request May 16, 2017
…tch1"

This reverts commit 3549ff2, reversing
changes made to 1db6771.
dbkr added a commit that referenced this pull request May 16, 2017
@t3chguy t3chguy deleted the t3chguy/BaseDialog-patch1 branch October 29, 2017 17:27
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.

5 participants