Skip to content

Replace border to outline in <NavItem> to prevent jumping #982

@ai

Description

@ai

Right now, when I click in <NavItem> (package‘s tabs like Files, Versions) elements in navigation bar jumps by 1 px. The same behavior by moving :focus there by pressing Tab.

Here is an example from @sitnik/nanoid.

Grabacion.de.pantalla.desde.2025-02-22.20-53-25.mp4

It happens because on :focus we are adding border (which change element size). To avoid this problem it is recommended to use outline or box-shadow.

I suggest use outline for :focus style.

I also suggest use :focus-visible instead of :focus. This style will be added not on every click by only if user use keyboard navigation. It is also a good practice.

Sorry, I can’t send PR since I do not work with Tailwind CSS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions