Skip to content

Commit

Permalink
fix(ListBox): add title attribute to selected item (#9399)
Browse files Browse the repository at this point in the history
* fix(ListBox): add title attribute to selected item

* test(snapshot): update snapshots

* fix(Dropdown): remove console log
  • Loading branch information
tw15egan authored Aug 24, 2021
1 parent 1b4811e commit 097d5d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react/src/components/ComboBox/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ const ComboBox = React.forwardRef((props, ref) => {
aria-expanded={rootProps['aria-expanded']}
aria-haspopup="listbox"
aria-controls={inputProps['aria-controls']}
title={textInput?.current?.value}
{...inputProps}
{...rest}
ref={mergeRefs(textInput, ref)}
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ const Dropdown = React.forwardRef(function Dropdown(
className={`${prefix}--list-box__field`}
disabled={disabled}
aria-disabled={disabled}
title={selectedItem ? itemToString(selectedItem) : label}
{...toggleButtonProps}
ref={mergeRefs(toggleButtonProps.ref, ref)}>
<span className={`${prefix}--list-box__label`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ exports[`Dropdown should render 1`] = `
id="downshift-0-toggle-button"
onClick={[Function]}
onKeyDown={[Function]}
title="input"
type="button"
>
<span
Expand Down Expand Up @@ -222,6 +223,7 @@ exports[`Dropdown should render custom item components 1`] = `
id="downshift-6-toggle-button"
onClick={[Function]}
onKeyDown={[Function]}
title="input"
type="button"
>
<span
Expand Down Expand Up @@ -530,6 +532,7 @@ exports[`Dropdown should render with strings as items 1`] = `
id="downshift-4-toggle-button"
onClick={[Function]}
onKeyDown={[Function]}
title="input"
type="button"
>
<span
Expand Down

0 comments on commit 097d5d9

Please sign in to comment.