microsoft / microsoft/fluentui-blazor
rfc: Global keyboard shortcuts that respect modal dialog
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 483
- Avg merge
- 14h 41m
- Merged PRs (30d)
- 68
Description
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.XShortCut.Control.Shift.PShortCut.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?
In the following screenshot
2: Which key on Windows is the final meta icon?
3: What is Location, and what other possibilities are there?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Core/Components/KeyCode/Services/KeyCodeService.cs and the IKeyCodeService entry point mentioned in the issue. Review how key combinations, List, ReaderWriterLockSlim, Location, and the final meta key are currently handled. Done would require an agreed design for global shortcuts, modal behavior, and integration with the existing service.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100