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

FocusZone and FocusTrapZone example improvements #8505

Merged
merged 3 commits into from
Apr 1, 2019

Conversation

ecraig12345
Copy link
Member

@ecraig12345 ecraig12345 commented Mar 27, 2019

Pull request checklist

  • Include a change request file using $ npm run change

Description of changes

Convert the FocusZone and FocusTrapZone examples to use css-in-js rather than SCSS so they can be exported to CodePen. I also made some improvements to the styling of the examples (with the magic of Stacks!) and did various other code cleanup.

Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented Mar 28, 2019

Size Auditor did not detect a change in bundle size for any component!

@@ -44,11 +44,9 @@ export default class BoxExample extends React.Component<React.HTMLAttributes<HTM
const { isChecked } = this.state;

return (
<div className="ms-FocusTrapZoneBoxExample">
<div className={contentClass}>
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason not to use a Stack here? Seems to be a need for a container with styling, which sounds like a Stack case to me. Since this is an example I'd rather steer people towards Stack than div with mergeStyles usage. (This comment applies to multiple examples in this PR.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I made them all use Stacks (and look nicer). While doing that and looking at the examples, I realized that the toggles in most of the examples were totally redundant with the buttons, so I took them out. Let me know if you disagree with that.

Copy link
Member

Choose a reason for hiding this comment

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

The only concern I have with removing the Toggle is that it's less obvious that there is a FocusTrapZone active preventing interaction with the rest of the page...

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm interesting. Maybe I could remove the buttons instead? It just seems wrong to have multiple ways of entering/exiting the trap zone...

Copy link
Member

Choose a reason for hiding this comment

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

That seems fair. I think the Toggles make it a little more clear when an FTZ is active and preventing you from interacting with the rest of the component page:
image

<div className="ms-Row">
<FocusZone direction={FocusZoneDirection.horizontal}>
export const FocusZoneDisabledExample: React.StatelessComponent = () => (
<Stack gap={20} horizontalAlign="start">
Copy link
Member

Choose a reason for hiding this comment

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

I'm hoping we can get #8247 in sooner than later rather than continue to sprinkle gap in our examples which I think it a styling anti-pattern. (I'm also curious if warnDeprecations on gap will cause build issues with all of these as well.)

Copy link
Member Author

@ecraig12345 ecraig12345 Mar 28, 2019

Choose a reason for hiding this comment

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

Yeah @khmakoto will have to do a find/replace of gap before checking in his PR. An alternative to prevent further delays to the big PR would be omitting the warnDeprecations call for now, then doing a separate PR to add the warning and fix all instances.

Copy link
Member

Choose a reason for hiding this comment

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

I'm working on getting the changes so we can check that PR. Hopefully I'll get that done today.

@khmakoto khmakoto closed this Mar 28, 2019
@khmakoto khmakoto reopened this Mar 28, 2019
@khmakoto
Copy link
Member

Closing and reopening to trigger new PR job on Dev Ops.

@JasonGore
Copy link
Member

I like the new look! 👍

image

@khmakoto
Copy link
Member

khmakoto commented Apr 1, 2019

@JasonGore could you take another look at this PR?

@dzearing dzearing merged commit 2a358d7 into microsoft:master Apr 1, 2019
@msft-github-bot
Copy link
Contributor

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

Handy links:

@ecraig12345 ecraig12345 deleted the focus-examples branch April 4, 2019 00:20
@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.

5 participants