Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix keyboard shortcuts, url casing and JSDisconnectedException #2466

Merged
merged 4 commits into from
Feb 27, 2024

Conversation

tlmii
Copy link
Member

@tlmii tlmii commented Feb 27, 2024

Fixes #2458
Fixes #2461
Fixes #2462

I'm a little surprised KeyboardEventArgs doesn't have a modifierkeys flags enum or something, so the checks to ensure other modifier keys (alt, ctrl) are not pressed are a little uglier than they could be. But this ensures they're only getting fired when the appropriate modifier keys (shift in some cases, none in others) are pressed.

Microsoft Reviewers: Open in CodeFlow

@davidfowl
Copy link
Member

This goes into p4 right?

@tlmii
Copy link
Member Author

tlmii commented Feb 27, 2024

This goes into p4 right?

@davidfowl Pending discussion mentioned here: #2465 (review)

@@ -184,7 +184,7 @@ private void SetPanelSizes(float panel1Fraction)

public async Task OnPageKeyDownAsync(KeyboardEventArgs args)
{
if (_splitterRef is null || !args.ShiftKey)
if (_splitterRef is null || !args.ShiftKey || args.AltKey || args.CtrlKey)
Copy link
Member

Choose a reason for hiding this comment

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

There is also the MetaKey to check for. TIL that's the Windows key, or whatever your device equivalent is.

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey

Copy link
Member

Choose a reason for hiding this comment

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

Put this logic into a helper method somewhere and reuse from all the OnPageKeyDownAsync places.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hrm. I didn't realize that was what MetaKey was... but also all the keyboard shortcuts I tried with the windows key seemed to get intercepted before the browser got them. But I'll add it anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added that check.

Put this logic into a helper method somewhere and reuse from all the OnPageKeyDownAsync places.

Done. Though have I mentioned I hate naming?

Copy link
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

Wait for tomorrow before merging.

@adamint
Copy link
Member

adamint commented Feb 27, 2024

Merging, combining the three separate PR commits and cherry picking back into p4

@adamint adamint enabled auto-merge (squash) February 27, 2024 15:50
@adamint adamint merged commit 197c21e into dotnet:main Feb 27, 2024
8 checks passed
adamint pushed a commit to adamint/aspire that referenced this pull request Feb 27, 2024
…t#2466)

* Fix keyboard shortcuts and url casing

* Suppress JSDisconnectedException

* Check MetaKey and refactor modifier key checks

---------

Co-authored-by: Adam Ratzman <adam@adamratzman.com>
(cherry picked from commit 197c21e)
adamint pushed a commit to adamint/aspire that referenced this pull request Feb 27, 2024
…t#2466)

* Fix keyboard shortcuts and url casing

* Suppress JSDisconnectedException

* Check MetaKey and refactor modifier key checks

---------

Co-authored-by: Adam Ratzman <adam@adamratzman.com>
(cherry picked from commit 197c21e)
joperezr pushed a commit that referenced this pull request Feb 27, 2024
* Fix shortcuts changing multiple browser windows (#2470)

* Fix shortcuts changing multiple browser windows

* Clean up

(cherry picked from commit fcadd63)

* Fix keyboard shortcuts, url casing and JSDisconnectedException (#2466)

* Fix keyboard shortcuts and url casing

* Suppress JSDisconnectedException

* Check MetaKey and refactor modifier key checks

---------

Co-authored-by: Adam Ratzman <adam@adamratzman.com>
(cherry picked from commit 197c21e)

* Untrack DialogReference when dialog is closed (#2465)

* Untrack DialogReference when dialog is closed

* Fix keyboard shortcuts and url casing

* Suppress JSDisconnectedException

* Check MetaKey and refactor modifier key checks

* removed redundant extra OnDialogCloseRequested call

---------

Co-authored-by: Adam Ratzman <adam@adamratzman.com>
Co-authored-by: Ratzman, Adam Mortimer <aratzman@iu.edu>
(cherry picked from commit 0a7b6c7)

* Use OnDialogClosing instead of OnDialogResult to remove dialog reference in MainLayout (#2476)

* Use OnDialogClosing instead of OnDialogResult

* Remove redundant event listener

---------

Co-authored-by: Adam Ratzman <adamratzman@microsoft.com>
(cherry picked from commit 1434b99)

---------

Co-authored-by: James Newton-King <james@newtonking.com>
Co-authored-by: Tim Mulholland <tlmii@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants