Skip to content

Selections in unfocused iframes should render as inactive. #48254

Closed

Description

@Psychpsyo

In other browsers, when creating a selection within an iframe, that selection turns gray once you click outside of the iframe, probably to indicate that it's not going to respond to keyboard inputs of any kind.

Collapsed selections that usually show up as a blinking caret also do not show their caret when they would be gray.

Opening this because I just PR'd #48253 and while a regular selection looking normal in an unfocused iframe isn't too bad, having a blinking caret that won't type anything is quite confusing.

Activity

  1. added
    C-untriaged
    on Sep 21, 2026
  2. mrobinson commented on Sep 23, 2026

    @mrobinson
    Member

    I'm a bit surprised that there can be two selections in the same document tree. Are you sure this is the case? It is the case that unfocusing the top-level window should render the selection as gray.

  3. Psychpsyo commented on Sep 23, 2026

    @Psychpsyo
    ContributorAuthor

    I'm a bit surprised that there can be two selections in the same document tree. Are you sure this is the case? It is the case that unfocusing the top-level window should render the selection as gray.

    You can try for yourself:

    <!DOCTYPE html>
    Some text outside of the iframe
    <iframe srcdoc="Some text inside of the iframe">

    All major browsers agree that there's two separate documents with their own selections at play here. A selection started outside of the iframe cannot extend into it and one that started inside of it cannot extend out of it. Similarly, Ctrl+A to select all is scoped to whichever of the two documents has focus and doesn't touch the other one.

    In my opinion, this is weird and unintuitive and probably bad, but since all browsers seem to agree on this, I'm not sure how good of an idea it is to challenge the status quo here.

  4. added a commit that references this issue on Sep 25, 2026
    15aa067
  5. added a commit that references this issue on Oct 6, 2026
    f511f69
  6. added a commit that references this issue on Oct 12, 2026
    ed61a98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions