Fall ce-0069 · Szenario scenario-autofocus-behavior

autofocus attribute does not work on contenteditable

OS: Windows 11 Gerät: Desktop or Laptop Any Browser: Chrome 120.0 Tastatur: US Entwurf
autofocusfocuschromewindows

Diese Seite wurde noch nicht übersetzt

Derzeit wird der englische Originalinhalt angezeigt. Wir freuen uns über Ihre Hilfe bei der Übersetzung.

Phenomenon

The autofocus attribute, which automatically focuses form inputs on page load, does not work on contenteditable elements. There is no built-in way to automatically focus a contenteditable region when a page loads.

Reproduction example

  1. Create a contenteditable div with autofocus attribute.
  2. Load the page.
  3. Observe whether the contenteditable receives focus automatically.

Observed behavior

  • In Chrome on Windows, the autofocus attribute is ignored on contenteditable.
  • The contenteditable does not receive focus automatically.
  • Manual JavaScript focus() call is required.

Expected behavior

  • The autofocus attribute should work on contenteditable.
  • Or, there should be a standard way to auto-focus contenteditable regions.
  • Focus should be handled consistently with form inputs.

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: Windows 11
Device: Desktop or Laptop Any
Browser: Chrome 120.0
Keyboard: US
Your environment

Use this editable area to reproduce the described case.

Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.