Skip to content

Conversation

@spmonahan
Copy link
Contributor

Cherry picks a change from master that adds keyboard behavior overrides to SelectionZone.

Original pull request: #23487

spmonahan and others added 4 commits June 15, 2022 16:31
Cherry picked from master.

* selectionzone: add override for escape key behavior

Prior to this change pressing the escape key would deselect any selected
elements within the SelectionZone and stop event propagation.

This commit adds a prop called `selectionClearedOnEscapePress` to
SelectionZone that allows this behavior to be configured. The default
value is `true` which preserves the prior behavior. When this value is
set to `false`, presses to the escape key will not change the selection
in any way and the SelectionZone will not stop the event propgation.

* detailslist: configure selectionzone based on `isSelectedOnFocus`

Configures the behavior of DetailsList's internal SelectionZone based on
the value of `isSelectedOnFocus`.

* selectionzone: adds prop to override default space key toggle behavior

By default a SelectionZone inside a DetailsList requires users to press
`ctrl/meta + space` to toggle values. Simply pressing `space` will
deselect all selected values and select the focused value. No change
happens when pressing `space` on a selected item.

This change adds a `toggleWithoutModifierPressed` to `SelectionZone` that
allows users to opt out of this behavior and get the multi-select
toggle behavior with just the `space` key.

DetailsLists makes use of this be opting out of the default behavior
when `isSelectedOnFocus` is set to true.

* detailslist: add keyboard override example

Adds an example demonstrating the `isSelectedOnFocus` keyboard overrides
for DetailsList.

* change files

* update @fluentui/react api snapshot

* add detailslist keyboard overrides example to public docsite

* update docsite detailslist page files

* selectionzone: make mouse clicks work correctly with toggle override

There is a code path in SelectionZone that disables part of the mouse
handling code when a modifier is pressed. This commit updates the
component to use that path based on the value of `toggleWithoutModifierPressed`.

Co-authored-by: Sarah Higley <sarah.higley@microsoft.com>
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 15, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f4f043b:

Sandbox Source
Fluent UI Button Configuration

@size-auditor
Copy link

size-auditor bot commented Jun 16, 2022

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react office-ui-fabric-react-DetailsList 221.252 kB 221.502 kB ExceedsBaseline     250 bytes
office-ui-fabric-react office-ui-fabric-react-ShimmeredDetailsList 231.709 kB 231.959 kB ExceedsBaseline     250 bytes
office-ui-fabric-react office-ui-fabric-react-ExtendedPicker 90.22 kB 90.404 kB ExceedsBaseline     184 bytes
office-ui-fabric-react office-ui-fabric-react-MarqueeSelection 68.579 kB 68.763 kB ExceedsBaseline     184 bytes
office-ui-fabric-react office-ui-fabric-react-Selection 38.263 kB 38.447 kB ExceedsBaseline     184 bytes
office-ui-fabric-react office-ui-fabric-react-Pickers 282.714 kB 282.898 kB ExceedsBaseline     184 bytes

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

Baseline commit: 0213db95dea2f397de467d3f53f6fef0a7f7df68 (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Jun 16, 2022

Perf Analysis

No significant results to display.

All results

Scenario Render type 7.0 Ticks PR Ticks Iterations Status
BaseButton mount 953 918 5000
Breadcrumb mount 43298 43604 5000
Checkbox mount 1563 1572 5000
CheckboxBase mount 1255 1312 5000
ChoiceGroup mount 5007 5004 5000
ComboBox mount 948 924 1000
CommandBar mount 7908 8027 1000
ContextualMenu mount 14640 14739 1000
DefaultButton mount 1132 1180 5000
DetailsRow mount 3745 3910 5000
DetailsRowFast mount 3830 3898 5000
DetailsRowNoStyles mount 3553 3535 5000
Dialog mount 2370 2343 1000
DocumentCardTitle mount 1815 1833 1000
Dropdown mount 2604 2558 5000
FocusTrapZone mount 1799 1823 5000
FocusZone mount 1842 1846 5000
IconButton mount 1789 1770 5000
Label mount 350 347 5000
Layer mount 1996 1950 5000
Link mount 451 447 5000
MenuButton mount 1488 1495 5000
MessageBar mount 2097 2152 5000
Nav mount 3308 3328 1000
OverflowSet mount 1409 1458 5000
Panel mount 1510 1469 1000
Persona mount 946 966 1000
Pivot mount 1449 1454 1000
PrimaryButton mount 1269 1323 5000
Rating mount 7941 8000 5000
SearchBox mount 1282 1332 5000
Shimmer mount 2579 2590 5000
Slider mount 1546 1526 5000
SpinButton mount 5140 5219 5000
Spinner mount 429 418 5000
SplitButton mount 3329 3233 5000
Stack mount 484 505 5000
StackWithIntrinsicChildren mount 1734 1730 5000
StackWithTextChildren mount 4837 4917 5000
SwatchColorPicker mount 10864 10663 5000
TagPicker mount 2972 2882 5000
TeachingBubble mount 52152 52908 5000
Text mount 444 431 5000
TextField mount 1500 1439 5000
Toggle mount 836 844 5000
button mount 114 108 5000

@spmonahan
Copy link
Contributor Author

I've accepted the Screener changes as they are all related to known issues (images loading/not loading, etc).

…a99d.json

Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com>
@spmonahan
Copy link
Contributor Author

@ThomasMichon could you take a look at this please?

@spmonahan spmonahan merged commit 4a5c25a into microsoft:7.0 Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants