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

Separates out focusedInput from DOM Focus and focuses on the calendar for withPortal implementations #410

Merged
merged 1 commit into from
Mar 31, 2017

Conversation

majapw
Copy link
Collaborator

@majapw majapw commented Mar 30, 2017

This, as far as I can tell, should be a fix for #246.

I'm going to favor this PR over #409 because it paves the way better for #301.

@airbnb/webinfra @moonboots PTAL

@majapw majapw added the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Mar 30, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 87.359% when pulling 23fa1f1 on maja-fix-done-bottom-bar-on-ios into f99432a on master.

const { onFocusChange, withPortal, withFullScreenPortal } = this.props;

if (focusedInput) {
const moveFocusToDayPicker = withPortal || withFullScreenPortal;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make more sense to target based on touch instead of portal presence? The mobile vertical scrollable date picker doesn't use these portal props, but it also requires daypicker focus.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm, well my thought is that it only makes sense to do this when the input is not visible... but maybe on touch devices makes sense too. Is the input going to be visible at the top of the VERTICAL_SCROLLABLE DayPicker? I forget what the designs look like

Copy link
Collaborator

Choose a reason for hiding this comment

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

The input will always be visible with VERTICAL_SCROLLABLE, and the focus should stick back to the day picker after tapping an input.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, let's have this occur always for portals and also always on touch devices.

// i18n
phrases: DateRangePickerInputPhrases,
};

export default class DateRangePickerInputWithHandlers extends React.Component {
export default class DateRangePickerInputController extends React.Component {
Copy link
Collaborator

Choose a reason for hiding this comment

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

💯 This has thrown a wrench in many of my greps

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TYPOS. hooray!

@majapw majapw force-pushed the maja-fix-done-bottom-bar-on-ios branch 2 times, most recently from f164861 to 93fde60 Compare March 30, 2017 21:33
@majapw
Copy link
Collaborator Author

majapw commented Mar 30, 2017

@moonboots PTAL

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 87.282% when pulling 93fde60 on maja-fix-done-bottom-bar-on-ios into f1cee85 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.009%) to 87.313% when pulling 93fde60 on maja-fix-done-bottom-bar-on-ios into f1cee85 on master.

@@ -19,6 +19,8 @@ const propTypes = forbidExtraProps({
onFocus: PropTypes.func,
onKeyDownShiftTab: PropTypes.func,
onKeyDownTab: PropTypes.func,

isFocused: PropTypes.bool, // describes actual DOM focus
Copy link
Contributor

Choose a reason for hiding this comment

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

A little confused about the distinction between this bool and focused by name alone. Seems like it'd be better as something like focusInputDOM or something that makes it more explicit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted parity with focusing the DayPicker as well.

this.setState({
isDateRangePickerInputFocused: false,
isDayPickerFocused: false,
showKeyboardShortcuts: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't exist yet does it? Isn't that in the a11y PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops!

className="DayPicker__focus-region"
ref={(ref) => { this.container = ref; }}
role="region"
tabIndex={0}
Copy link
Contributor

Choose a reason for hiding this comment

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

is this something you specifically want users to be able to tab to or just to focus? Seems like something that should be more for focusing purposes, in which case you'd want a tabindex of -1

@majapw majapw force-pushed the maja-fix-done-bottom-bar-on-ios branch from 93fde60 to 03d5326 Compare March 30, 2017 23:45
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.009%) to 87.313% when pulling 03d5326 on maja-fix-done-bottom-bar-on-ios into f1cee85 on master.

@majapw majapw force-pushed the maja-fix-done-bottom-bar-on-ios branch from 03d5326 to a4b328f Compare March 31, 2017 20:37
@majapw majapw merged commit 308d54f into master Mar 31, 2017
@majapw majapw deleted the maja-fix-done-bottom-bar-on-ios branch March 31, 2017 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch: fixes/refactors/etc Anything that's not major or minor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants