-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Refactor switches, simplify code, fix related bugs. #5780
Merged
nathanmarks
merged 8 commits into
mui:next
from
nathanmarks:fix-radiogroup-keybd-selection
Dec 15, 2016
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
081c0a9
Refactor switches, simplify code, fix related bugs.
nathanmarks bab90d4
Support keyboard focus for contained elements
nathanmarks 1a532a0
Swap default/label exports for switches
nathanmarks e4592fa
Remove extra whitespace
nathanmarks cd1978a
Use createHelper
nathanmarks 5427bd6
Fix demos using wrong components
nathanmarks 69a529b
Fix radiogroup imperative focusing for dialog menu accessibility
nathanmarks 9710496
Add test for radiogroup focus helper
nathanmarks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* eslint-disable flowtype/require-valid-file-annotation */ | ||
|
||
export default from './Checkbox'; | ||
export Checkbox from './Checkbox'; | ||
export Checkbox, { LabelCheckbox } from './Checkbox'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ export const styleSheet = createStyleSheet('IconButton', (theme) => { | |
export default function IconButton(props, context) { | ||
const { | ||
accent, | ||
buttonRef, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
children, | ||
className, | ||
contrast, | ||
|
@@ -80,6 +81,7 @@ export default function IconButton(props, context) { | |
centerRipple | ||
keyboardFocusedClassName={classes.keyboardFocused} | ||
disabled={disabled} | ||
ref={buttonRef} | ||
{...other} | ||
> | ||
<span className={classNames(classes.label)}> | ||
|
@@ -96,6 +98,10 @@ IconButton.propTypes = { | |
* If true, will use the theme's accent color. | ||
*/ | ||
accent: PropTypes.bool, | ||
/** | ||
* @ignore | ||
*/ | ||
buttonRef: PropTypes.func, | ||
/** | ||
* The icon element. If a string is passed, | ||
* it will be used as a material icon font ligature. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about the motivation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviertassinari I wanted to put all the test helpers below the main part of the suite in one case. Functions are hoisted so there isn't any harm and in some scenarios it helps you leave more important stuff at the top. It isn't something that affects our react components because for the most part we have non-hoistables (class, assignment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a fight between important stuff at the top vs load the context before digging into the code. I prefer the second option but some flexibility won't harm 👍 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see that side too -- but on the other hand it can be confusing to open a file and it's hard to find the root
describe()
in a test because there's a bunch of helper functions first. In that case, you don't even know what they are for yet.