keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
403 stars 112 forks source link

feat: Add a `beep` argument for Emojis #12237

Open dyacob opened 3 months ago

dyacob commented 3 months ago

Is your feature request related to a problem? Please describe.

The audible beep cue is a helpful signal to the user that an error has been made, but the nature of the error may not be obvious. The ability to distinguish one beep cue from another would be helpful to the user to better understand the mistake.

Describe the solution you'd like

beep could be given an added argument for a string that would flash on the screen, then disappear. The expectation is that the text would be a single emoji character, but a developer may also decide to add a one or two-word message. For example:

... > context beep('🔔')

The 🔔 would be inserted in the text output for a moment, then immediately deleted. This flashing icon would then be helpful to users who have muted audio and to the hearing impaired. Developers could then select an emoji that provided some context about the error made so that the user can then determine the corrective action needed.

An optional 2nd argument could then indicate a delay in milliseconds before the emoji is deleted:

 ... > context beep('☠️')
 ... > context beep('⬆️')
 ... > context beep('😲', 600)
 ... > context beep('💜', 350)

The ability to contextualize a beep cue can also help with debugging a keyboard, the input rule matched can then be more easily recognized. Note that the audible beep would still be emitted along with the text of the first argument.

beep can become a user signal that does not necessarily have to be about error messaging. beep could be used to communicate other info to the user such as the end of possible composition has been reached, or how many modifications remain. An example below, where an optional boolean argument has been introduced where when TRUE (or 1/0) would suppress the audio.

  ... > context(1) '...'   beep('3️⃣ ',TRUE)
  ... > context(1) '...'   beep('2️⃣', TRUE)
  ... > context(1) '...'   beep('1️⃣', TRUE)
  ... > context(1) '...'   beep('🛑', 500, TRUE)  c or could be a celebratory '🎉'

Describe alternatives you've considered

An audio tone argument for beep so it can emit different contextual sounds, but this seems harder to implement and for developers to specify.

Related issues

No response

Keyman apps

Keyman version

17.0.328

Operating system

Any

Device

Any

Target application

Any

Browser

Any

Keyboard name

Any

Keyboard version

Any

Language name

Any

Additional context

No response

mcdurdin commented 3 months ago

Thank you for the suggestion. This is not really implementable as a text modification, because we cannot guarantee we have access to the text store except during a keystroke transaction. So we could insert the bell into the text but then not be able to remove it again. However, we could pop an icon on-screen as a separate UI element, briefly, as an alternative to an audio bell. This is something we'd consider for a future release.