Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combobox: Fixes multiselect selected values not being read #11436

Merged
merged 18 commits into from
Dec 18, 2019

Conversation

joschect
Copy link
Contributor

@joschect joschect commented Dec 11, 2019

Pull request checklist

Description of changes

This fixes 2 accessibility problems with multiselect combobox.

  1. Selected options in the input would disappear when a user entered into it, this was confusing as it appeared that the current selection is gone. This is not a perfect solution but it does enable the user to have some knowledge that their selected options aren't gone.
  2. That selected options weren't read out. They are now added to the label so the selected options are read.

Focus areas to test

One big potential problem with this change is that it removes a zero width space that may have been used to help prevent bad values from being returned in onChange and fixed issue #3055. I believe it's safe to remove because I tested both locally and added a test to check for it and at no point was an incorrect value returned. Additionally the zero width space was almost always stripped out before the value could be saved so it's unlikely that users interacted/relied on it.

I verified that you can still select/save an empty value if freeform is enabled and that the combobox still interacts with an empty option correctly.

Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented Dec 11, 2019

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react ComboBox 227.852 kB 228.275 kB ExceedsBaseline     423 bytes

ExceedsTolerance Over Tolerance (1024 B) ExceedsBaseline Over Baseline BelowBaseline Below Baseline New New Deleted  Removed 1 kB = 1000 B

Baseline commit: 2150212f54760164dd08b3781f80c3ecfad6ca14 (build)

} = this.props;
const { isOpen, focused, suggestedDisplayValue } = this.state;
this._currentVisibleValue = this._getVisibleValue();
const multiselectPlaceholder = multiSelect
? this._getMultiselectDisplayString(this.state.selectedIndices, this.state.currentOptions, suggestedDisplayValue)
: '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

''; [](start = 8, length = 3)

Should this be set to undefined instead of an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. I'll change it and see.

@jspurlin
Copy link
Contributor

}

Does this fn (and where it's called) still need to be in the code?


Refers to: packages/office-ui-fabric-react/src/components/ComboBox/ComboBox.tsx:2130 in 0c5019f. [](commit_id = 0c5019f, deletion_comment = False)

@jspurlin
Copy link
Contributor

This is slightly scary... but I trust your validation :)

@joschect
Copy link
Contributor Author

}

Does this fn (and where it's called) still need to be in the code?

Refers to: packages/office-ui-fabric-react/src/components/ComboBox/ComboBox.tsx:2130 in 0c5019f. [](commit_id = 0c5019f, deletion_comment = False)

I'm having a little trouble finding what you're referencing here. Could you point me to it?

@jspurlin
Copy link
Contributor

jspurlin commented Dec 12, 2019

}

Does this fn (and where it's called) still need to be in the code?
Refers to: packages/office-ui-fabric-react/src/components/ComboBox/ComboBox.tsx:2130 in 0c5019f. [](commit_id = 0c5019f, deletion_comment = False)

I'm having a little trouble finding what you're referencing here. Could you point me to it?

(I selected the code and commented, it seems to have just chosen the last line...)

This is referring to the _removeZeroWidthSpaces function

@msft-github-bot
Copy link
Contributor

Component Perf Analysis

No significant results to display.

All results

Scenario Master Ticks PR Ticks Status
BaseButton 742 693
BaseButton (experiments) 982 953
DefaultButton 1027 977
DefaultButton (experiments) 1896 1949
DetailsRow 3304 3214
DetailsRow (fast icons) 3310 3326
DetailsRow without styles 3137 3041
DocumentCardTitle with truncation 32600 32240
MenuButton 1284 1301
MenuButton (experiments) 3505 3427
PrimaryButton 1204 1153
PrimaryButton (experiments) 1981 1985
SplitButton 2755 2781
SplitButton (experiments) 6767 6866
Stack 467 473
Stack with Intrinsic children 1152 1090
Stack with Text children 4166 4230
Text 379 383
Toggle 829 858
Toggle (experiments) 2221 2198
button 64 58

@joschect joschect merged commit ccedc92 into microsoft:master Dec 18, 2019
@msft-github-bot
Copy link
Contributor

🎉[email protected] has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants