Skip to content

[css-ui] Proposal: change outline-offset initial value to auto #13587

Open

Description

@sb3nder

Problem

When outline-style: auto is used in combination with outline-offset,
Chrome currently subtracts around 1px from the used value of outline-offset to help keep focus outlines visible in overflow scenarios not handled by authors.

Unfortunately, when the author wants to handle the offset themselves, this makes outline-offset very hard to use in a predictable way in Chrome and in an interoperable way across browsers.

In other UAs, outline-offset currently behaves normally with outline-style: auto, but I don’t think this interaction is clearly specified, so I’m not sure there is a guarantee that this behavior would not change in the future, for example due to UA stylistic or accessibility changes.


Maybe changing the initial value of outline-offset to auto could give UAs enough flexibility to choose their own default offset, while making numeric values specified by authors behave normally.

Activity

  1. sb3nder commented on Mar 11, 2026

    @sb3nder
    Author
  2. sb3nder commented on Apr 6, 2026

    @sb3nder
    ContributorAuthor

    Update regarding WebKit (as of today, build 310633@main):
    for outline-style: auto:

    • outline-width is no longer taken into consideration.
    • outline-offset: 0px has an effective offset of 0px, and any other value also reflects the effective offset.
    • The rendered width should scale with zoom (I don't see this fixed in my build, but I guess it's fixed in Safari).

    Fix outline: auto in user agent style sheets WebKit#1740
    Enable zooming outline: auto WebKit#61077
    Ignore outline-width when outline-style is auto WebKit#61497

    Super happy with these changes.

  3. sb3nder commented on Apr 6, 2026

    @sb3nder
    ContributorAuthor

    Additionally, WebKit is proposing outline-offset: inset #13765, but I'm still unsure if it's the right approach as currently proposed.

  4. changed the title [-][css-ui] Proposal: Allow `outline-offset` to reflect the effective offset for `outline-style: auto`[/-] [+][css-ui] Proposal: change `outline-offset` initial value to `auto`[/+] on May 25, 2026
  5. sb3nder commented on May 25, 2026

    @sb3nder
    ContributorAuthor

    I gave a look at Chrome code... it's effective offset is basically:
    (All lengths are in device pixels)

    // specifiedSnappedOffset = ...
    // minBorderWidth = ...
    // effectiveZoom = devicePixelRatio * totalZoom;
    
    let offset = specifiedSnappedOffset;
    
    const maxInsideBorderWidth = Math.max(Math.floor(1 * effectiveZoom), 1);
    if (minBorderWidth >= maxInsideBorderWidth)
    	offset -= maxInsideBorderWidth;
    
    const halfInnerStrokeWidth = Math.max(Math.floor(3 * effectiveZoom), 3) / 3;
    // const innerStrokeWidth = halfInnerStrokeWidth * 2;
    offset -= halfInnerStrokeWidth;
    
    // InnerStrokeWidth is not always an integer. If effectiveZoom is between N + 0.3333... and N + 1
    // then Chrome renders blurry outlines for these values.
    
    // this offset includes the blurry part
    flooredOffset = Math.floor(offset);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions