Skip to content

[combobox][select] Hovered item gets highlighted when scroll changes in Safari #4002

Closed

Description

@literalpie

Bug report

Current behavior

On both the Combobox and the Select, if something like keyboard navigation causes the scroll position to change, focus moves to the item hovered by the mouse (even if the mouse has not moved)

Expected behavior

Ideally, if you're only using the keyboard to navigate, the item hovered by the mouse shouldn't become focused.

Reproducible example

  1. Open the Combobox example
  2. Position your mouse over an early fruit like "Orange"
  3. Use your keyboard arrow keys to try to select an item later in the list (such as Plum)
  4. When you reach the point where the list needs to scroll to show the focused item (in my case, "Peach"), focus will move to the position that is hovered by the mouse ("Orange"). To reach "Plum" using only arrow keys this will happen multiple times

Let me know if you want a repro where "Select" shows this issue more obviously.

Base UI version

1.1.0

Which browser are you using?

Safari

I tested in Chrome and this is not an issue.

Which OS are you using?

macOS 26.2

Additional context

Ark UI and Radix seem to have the same issue, so maybe this is expected, or too edge-case-y to worry about.

Activity

  1. added
    status: waiting for maintainer
    on Feb 6, 2026
  2. added
    component: select
    browser: Safari
    component: combobox
    and removed
    status: waiting for maintainer
    on Feb 6, 2026
  3. changed the title [-][Combobox, Select] hovered item gets selected when scroll changes[/-] [+][combobox][select] Hovered item gets highlighted when scroll changes in Safari[/+] on Feb 6, 2026
  4. bennobuilder commented on May 2, 2026

    @bennobuilder

    Confirmed on our side as well.

    We reproduced this both:

    • in Safari on the Base UI docs
    • in our desktop app running in Tauri's native WebKit view on macOS

    A local workaround that behaves well for us is to intercept onMouseMoveCapture on the item and ignore stationary WebKit mousemove events before Base UI handles them:

    const ComboboxItem: React.FC<Combobox.Item.Props> = (props) => {
      const { onMouseMoveCapture, ...rest } = props;
    
      const handleMouseMoveCapture = React.useCallback(
        (
          event: Parameters<NonNullable<Combobox.Item.Props['onMouseMoveCapture']>>[0]
        ) => {
          onMouseMoveCapture?.(event);
          if (event.isPropagationStopped()) {
            return;
          }
     
    	  // Ignore WebKit zero-delta mousemove events during keyboard list scrolling, see https://github.com/mui/base-ui/issues/4002
          const nativeEvent = event.nativeEvent;
          const isStationaryWebKitMouseMove =
            'webkitForce' in nativeEvent &&
            nativeEvent.movementX === 0 &&
            nativeEvent.movementY === 0;
          if (isStationaryWebKitMouseMove) {
            event.stopPropagation();
          }
        },
        [onMouseMoveCapture]
      );
    
      return <Combobox.Item {...rest} onMouseMoveCapture={handleMouseMoveCapture} />;
    }

    builder-group/abstand@e561a50

  5. github-actions commented on Jul 23, 2026

    @github-actions

    This fix will be available in the next npm release of Base UI.

    In the meantime, you can try it out on our Canary release channel:

    npm i https://pkg.pr.new/@base-ui/react@5265
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

    browser: Safaricomponent: comboboxcomponent: select

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions