Skip to content

Add FocusTrapCallout Component#7488

Merged
atneik merged 5 commits into
microsoft:masterfrom
atneik:callout-trapfocus
Jan 4, 2019
Merged

Add FocusTrapCallout Component#7488
atneik merged 5 commits into
microsoft:masterfrom
atneik:callout-trapfocus

Conversation

@atneik

@atneik atneik commented Dec 28, 2018

Copy link
Copy Markdown
Contributor

Pull request checklist

Description of changes

  • Added a composite component called FocusTrapCallout to allow ability to trap focus in a Callout. Consumers can pass in the props as they would have in a regular Callout in addition they can pass FocusTrapZone props via focusTrapProps to customize the trap.
  • Updated CardCallout in HoverCard to use the above component
Microsoft Reviewers: Open in CodeFlow

@cliffkoh cliffkoh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a little confused by the need to create a standalone FocusTrapCallout which is exported at the index - is there a desire for people to use this in isolation?

If not, could we not just inline the whole thing?

Comment thread packages/office-ui-fabric-react/src/components/Callout/FocusTrapCallout.tsx Outdated
Comment thread packages/office-ui-fabric-react/src/components/Callout/FocusTrapCallout.tsx Outdated
Comment thread packages/office-ui-fabric-react/src/components/Callout/FocusTrapCallout.tsx Outdated
Comment thread packages/office-ui-fabric-react/src/components/Callout/index.ts
import { IBaseCardProps } from '../BaseCard.types';
import { FocusTrapCallout, ICalloutProps } from '../../Callout';

export interface ICardCalloutProps extends IBaseCardProps<{}, {}, {}> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just realized that whatever I said above about FocusTrapCallout applies to this very component itself too, although at least this is a stateless component (though not explicitly typed as such).

Can we document these props?

@cliffkoh cliffkoh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @atneik, I didn't realize CardCallout.tsx was in HoverCard and not within Callout component. As such, please disregard the questions asking if it needed to be exported.

In this case though, we really need to do a lot more work on the documentation front (writing examples, treating FocusTrapCallout as a first class "component" as far as documentation goes).

We should also make sure to add tests/screener since this is meant be to directly used by consumers as well.

@atneik

atneik commented Dec 29, 2018

Copy link
Copy Markdown
Contributor Author

@cliffkoh Yes it would need to be exported so that consumers and some of our components can use it. I see this one in lines with other composite components such as VirtualizedComboBox, DialogContent, DialogFooter, etc., which are exported and combine multiple other components to create a new one.

I totally agree we need to better document these types of components. We do have examples using them, but still need a list of these "modified components" on the component page itself. I think updating the documentation to include them should be out of scope of this PR.

@cliffkoh

cliffkoh commented Dec 29, 2018

Copy link
Copy Markdown
Contributor

cc @dzearing @aditima @natalieethell @micahgodbolt @Jahnp regarding the need to all-up have a better documentation story for exported component variants.

(We will need a component documentation overhaul anyway what with the upcoming component slots feature)

@size-auditor

size-auditor Bot commented Dec 29, 2018

Copy link
Copy Markdown
Component Baseline Size PR Size Size Change Bundle Size Tolerance Level
ActivityItem 158226 162519 4293 🔺
Button 214346 218635 4289 🔺
SelectedItemsList 273337 277623 4286 🔺
Grid 217742 222028 4286 🔺
MessageBar 223682 227968 4286 🔺
Pickers 309252 313538 4286 🔺
Pivot 223190 227476 4286 🔺
FloatingPicker 334424 338710 4286 🔺
Facepile 250885 255171 4286 🔺
ExtendedPicker 202683 206969 4286 🔺
SearchBox 220653 224939 4286 🔺
Nav 224023 228309 4286 🔺
DocumentCard 263624 267910 4286 🔺
ComboBox 273544 277830 4286 🔺
Breadcrumb 235211 239497 4286 🔺
SpinButton 227952 232238 4286 🔺
CommandBar 235505 239791 4286 🔺
SwatchColorPicker 232688 236974 4286 🔺
TeachingBubble 225532 229818 4286 🔺
Tooltip 122753 127034 4281 🔺
ContextualMenu 181952 186233 4281 🔺
Persona 151921 156202 4281 🔺
Callout 116533 120814 4281 🔺
PersonaCoin 151991 156269 4278 🔺
KeytipLayer 200506 204784 4278 🔺
Keytip 184861 189139 4278 🔺
Panel 231724 232131 407 🔺 ✔️
Dialog 234331 234738 407 🔺 ✔️
Dropdown 260979 261386 407 🔺 ✔️
HoverCard 131526 131908 382 🔺 ✔️
DatePicker 240581 240874 293 🔺 ✔️
Image 93983 93987 4 🔺 ✔️
KeytipData 67682 67686 4 🔺 ✔️
FocusZone 74695 74699 4 🔺 ✔️
Popup 65175 65179 4 🔺 ✔️
Divider 89068 89072 4 🔺 ✔️
GroupedList 176131 176132 1 🔺 ✔️
Icon 96044 96045 1 🔺 ✔️
DetailsList 251918 251919 1 🔺 ✔️
Fabric 89901 89902 1 🔺 ✔️
Layer 95545 95546 1 🔺 ✔️
ShimmeredDetailsList 266826 266827 1 🔺 ✔️
Modal 110238 110234 -4 🔻 ✔️
Coachmark 129799 129793 -6 🔻 ✔️
FocusTrapZone 66727 66681 -46 🔻 ✔️

@atneik

atneik commented Dec 31, 2018

Copy link
Copy Markdown
Contributor Author

Any idea why the bundle size took a hit?

@KevinTCoughlin

Copy link
Copy Markdown
Member

Any idea why the bundle size took a hit?

cc: @aftab-hassan

@aftab-hassan

Copy link
Copy Markdown
Contributor

Any idea why the bundle size took a hit?

The sizes are generated by the script apps/test-bundles/webpack.config.js. We don't currently have the functionality to drill down on these numbers and reason the bump, but have it planned for the next release. A bit tentative on the timeline, but we can re prioritize this.

@cliffkoh For now, can we unblock this PR by making the size audit check optional ?

@cliffkoh

cliffkoh commented Jan 3, 2019

Copy link
Copy Markdown
Contributor

@aftab-hassan the size audit check is already optional.. the PR is blocked because a code owner has not signed off.

@atneik
atneik merged commit 1b5b098 into microsoft:master Jan 4, 2019
@atneik
atneik deleted the callout-trapfocus branch January 4, 2019 22:24
@msft-github-bot

msft-github-bot commented Jan 7, 2019

Copy link
Copy Markdown
Contributor

🎉office-ui-fabric-react@v6.120.0 has been released which incorporates this pull request.:tada:

Handy links:

@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can tab outside of a callout

7 participants