Skip to content

Option background colors not filling very long labels #6020

Open
@johantiden

Description

@johantiden

https://codesandbox.io/p/sandbox/codesandboxer-example-forked-4z9lkz?file=%2Fexample.tsx%3A16%2C1

For very long options (or very small select boxes), the option background color does not extend into the right in the case where a horizontal scroll is needed. The selected and focused options' background is only as wide as the select box is, before scrolling.

Try the sandbox above or recreate it:

  1. Create a simple select box that has a very long option label
import React from "react";

import Select from "react-select";

export default () => (
  <Select
    options={[
      {
        label:
          "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong",
        value: "verylong",
      },
    ]}
  />
);
  1. Run it and open the dropdown by clicking the select box.
  2. Scroll to the right to see the rest of the label.
  3. See the white background

The expected behaviour is that the background color extends all the way to the right, to encompass the whole label.
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/bug-unconfirmedIssues that describe a bug that hasn't been confirmed by a maintainer yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions