Skip to content

rfc: Global keyboard shortcuts that respect modal dialog #3840

Open
@mrpmorris

Description

@mrpmorris

I am currently using "accesskey" for shortcuts, but this has proven to be a real pain because they are still activated even when there is a modal dialog open, and there is no way to stopPropagation / preventDefault on them even in javascript.

I suggested the following to Vincent on Discord...

<FluentButton Shortcut=@Shortcut.Control.S etc...>Save</FluentButton>
I could also have combinations for alt + control + shift

  • ShortCut.Alt.Control.X
  • ShortCut.Control.Shift.P
  • ShortCut.Alt.Control.Shift.R

You'd wrap your stuff in
<ShortcutHandler>

I could have it so when a new one is created it disables the previous (only the latest in the stack is executed) - Make that optional

<ShortcutHandler Mode=@ShortcutHandlerMode.Additive>

vs modal (default)

<ShortcutHandler Mode=@ShortcutHandlerMode.Exclusive>

This way we could have global shortcut keys for FluentButton, and also give us the opportunity to override/disable them in modal dialog windows. This would avoid using the html accesskey attribute.

He suggested I look at IKeyCodeService. I'd like your input on my suggestion, and if/how it would affect/integrate with this service.

Also, a few questions...

1: I'm wondering why you went with List and ReaderWriterLockSlim rather than ConcurrentList?

private ReaderWriterLockSlim ServiceLock { get; } = new ReaderWriterLockSlim();

In the following screenshot

Image

2: Which key on Windows is the final meta icon?
3: What is Location, and what other possibilities are there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions