Skip to content

Select event onBlur is executing when disabled #1248

@GomezIvann

Description

@GomezIvann

Describe the bug
The onBlur event is currently executing when the component is disabled. It also gains focus, leading to strange behaviour when tabbing between elements from the screen, since it does not jump between enabled items but also disabled selects.

To Reproduce

Code example:

const () => {
  const [value, setValue] = useState("");  
  const options = [
    { label: "Option 01", value: "1" },
    { label: "Option 02", value: "2" },
    { label: "Option 03", value: "3" },
    { label: "Option 04", value: "4" },
  ];
  const onBlur = ({ value, error }) => {
    setValue(value);
    console.log(value);
  };

  return (
    <DxcSelect
      label="Example"
      placeholder="Choose an option"
      options={options}
      value={value}
      onBlur={onBlur}
      disabled
    />
  );
};

Expected behaviour
The onBlur event must not be executed when the component is disabled.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingepicjiraThis task is referenced in a story of Jira

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions