Open Bug 1763669 Opened 2 years ago Updated 12 days ago

beforeinput event of React is not fired with MacOS accent popup selection

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

Firefox 99
Desktop
macOS
defect

Tracking

()

People

(Reporter: broomerjack, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(2 files)

Steps to reproduce:

  1. Using MacOS (v12.1), hold down the "a" key (or any standard english character with a latin accented variation) and wait for the accent popup to show up
  2. At this point the keydown and beforeinput events will have fired and the input should have the regular key inserted
  3. Select one of the options from the accent menu

Simple CodeSandbox: https://codesandbox.io/s/react-typescript-forked-wh6no9?file=/src/App.tsx

Actual results:

Observe that the keydown and input events fire but not the beforeinput event

Expected results:

I would have expected the beforeinput event to have fired

It's also worth mentioning that I would expect the beforeInput and input events to fire with the inputType of insertReplacementText on selecting a character from the accent popup because it does replace the previous character.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core

It works for me on Win11.

Flags: needinfo?(masayuki)
Attached image MacOS Popup Example

This is an example of the MacOS popup

Attached image Accent Input Event

I am seeing the beforeInput and input events here however, I would have expected the inputType to be insertReplacementText.

Hi Hsin, maybe there was some confusion but this bug is MacOS specific because Windows doesn't have the same accent popup menu. I added screenshots above to hopefully clear things up a bit.

I don't reproduce this with raw DOM event. So this could be a bug of React (or the testcase).

Flags: needinfo?(masayuki)

Okay, I'll have to do some more digging into that on my end. What about the other issue:

It's also worth mentioning that I would expect the beforeInput and input events to fire with the inputType of insertReplacementText on selecting a character from the accent popup because it does replace the previous character.

(In reply to broomerjack from comment #8)

Okay, I'll have to do some more digging into that on my end. What about the other issue:

It's also worth mentioning that I would expect the beforeInput and input events to fire with the inputType of insertReplacementText on selecting a character from the accent popup because it does replace the previous character.

Masayuki, do you have thoughts for above?

Flags: needinfo?(masayuki)

Indeed, Chrome dispatches beforeinput event with inputType="insertReplacementText" in the case. However, I don't have much time to work on this bug at least in this month...

Flags: needinfo?(masayuki)
Severity: -- → S3
Priority: -- → P3

Oh, if I enable textInput with the pref dom.events.textevent.enabled, beforeinput event also appears in the test case. So, it's a bug of React.

I think that insertReplacementText should be handled in a new bug.

Status: UNCONFIRMED → NEW
Depends on: 1889038
Ever confirmed: true
OS: Unspecified → macOS
Hardware: Unspecified → Desktop
Summary: beforeinput event not fired with MacOS accent popup selection → beforeinput event of React is not fired with MacOS accent popup selection
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: