Skip to content

Firefox: focusmanager.testmode=true persists after browser close, breaking fcitx5 input method #41135

@Quaop

Description

@Quaop

Description

When Playwright launches Firefox, it sets focusmanager.testmode = true in the user's Firefox profile. This pref is not cleaned up after Playwright exits, leaving it permanently in the user's normal Firefox profile.

This breaks fcitx5 (and likely other input method frameworks like IBus) in the user's daily browser, because focusmanager.testmode changes how focus events are dispatched, preventing the input method from properly receiving focus signals.

Steps to reproduce

  1. Use Playwright to launch Firefox (persistent or non-persistent context)
  2. Close Playwright
  3. Open Firefox normally
  4. Try using fcitx5/IBus input method (Ctrl+Space) → does not respond
  5. Check about:configfocusmanager.testmode is true
  6. Check prefs.js → contains user_pref("focusmanager.testmode", true);

Expected behavior

Playwright should:

  • Either only set testmode prefs in temporary/isolated profiles (not the user's default profile)
  • Or clean up testmode prefs when the browser context is closed

Actual behavior

focusmanager.testmode = true persists in the user's Firefox profile permanently, silently breaking input method functionality.

Environment

  • Playwright Python 1.60.0
  • Firefox 150.0.2 (Playwright-bundled)
  • Gentoo Linux, XFCE4 (X11)
  • fcitx5 5.1.19

Impact

Any Linux user who uses Playwright with Firefox and also uses fcitx5/IBus for CJK input will have their input method broken without any obvious cause. The user cannot reasonably connect "Playwright stopped working" to "my Chinese keyboard input is broken."

Workaround

Delete the pref from the user's Firefox profile:

sed -i '/focusmanager.testmode/d' ~/.mozilla/firefox/*.default*/prefs.js

Fix suggestion

Use a temporary/isolated profile for testmode prefs, or unset focusmanager.testmode on browser context close.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions