microsoft / microsoft/fluentui-blazor

rfc: Global keyboard shortcuts that respect modal dialog

Open
#3,840 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

community:question feature v5
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.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?

https://github.com/microsoft/fluentui-blazor/blob/ab5e0eb0a980c8a2edbdaa6c1934cf3508eee1f4/src/Core/Components/KeyCode/Services/KeyCodeService.cs#L10

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.