Skip to content

Commit

Permalink
Select - no longer update value while navigating dropdown (#2029)
Browse files Browse the repository at this point in the history
# Pull Request

## 🤨 Rationale

While in the midst of implementing the [clear
select](#1951) feature, I recognized
that the fact that we were updating the value while navigating the
dropdown was both confusing (since we don't update the display value)
and resulting in an awkward implementation for the feature.
  • Loading branch information
atmgrifter00 authored May 7, 2024
1 parent 0ac9d81 commit bbe2654
Show file tree
Hide file tree
Showing 8 changed files with 496 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Change Select to not update value as you navigate options in dropdown.",
"packageName": "@ni/nimble-components",
"email": "26874831+atmgrifter00@users.noreply.github.com",
"dependentChangeType": "patch"
}
11 changes: 11 additions & 0 deletions packages/nimble-components/src/list-option/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ export class ListOption extends FoundationListboxOption {
@attr({ attribute: 'visually-hidden', mode: 'boolean' })
public visuallyHidden = false;

/**
* @internal
* This attribute is used to control the visual selected state of an option. This
* is handled independently of the public 'selected' attribute, as 'selected' is
* representative of the current value of the container control. However, while
* a dropdown is open users can navigate through the options (requiring visual
* updates) without changing the value of the container control.
*/
@attr({ attribute: 'active-option', mode: 'boolean' })
public activeOption = false;

/** @internal */
@observable
public hasOverflow = false;
Expand Down
Loading

0 comments on commit bbe2654

Please sign in to comment.