-
Notifications
You must be signed in to change notification settings - Fork 194
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
✨ RSP-631 InputGroup: add Datepicker range variant #53
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e080337
RSP-631 InputGroup: add Datepicker range variant
majornista 65d896d
RSP-631 InputGroup: Datepicker range use em dash rather than en dash
majornista 1e12507
RSP-631 InputGroup: Datepicker range adjust dash based on text width
majornista dab1f78
RSP-631 InputGroup: Datepicker range updates per comments
majornista aad94e3
RSP-631 InputGroup: Datepicker range code comments
majornista 595750b
RSP-631 InputGroup: Datepicker fix vertical alignment of em-dash
majornista 2e822b9
RSP-631 Simplify em-dash positioning using flexbox
majornista 7366bb3
RSP-631 Use className rather than :nth-of-type pseudo-selector
majornista 120e9fe
Fix naming convention for start/end fields
lazd 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Date Picker - Range Quiet | ||
description: A date picker uses the input group component to display a field with a button next to it | ||
markup: | | ||
<div class="spectrum-InputGroup spectrum-InputGroup--quiet spectrum-Datepicker spectrum-Datepicker--range" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-startField" placeholder="mm/dd/yyyy" name="start" value="2018-10-01"> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-startField" placeholder="mm/dd/yyyy" name="end" value="2018-10-30"> | ||
<button type="button" class="spectrum-FieldButton spectrum-FieldButton--quiet" tabindex="-1" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
</div> | ||
|
||
<p /> | ||
|
||
<div aria-invalid="true" class="spectrum-InputGroup spectrum-InputGroup--quiet spectrum-Datepicker spectrum-Datepicker--range is-invalid" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-startField" aria-invalid="true" placeholder="mm/dd/yyyy" name="start" value="2018-10-01"> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-endField is-invalid" aria-invalid="true" placeholder="mm/dd/yyyy" name="end" value="2018-10-30"> | ||
<button type="button" class="spectrum-FieldButton spectrum-FieldButton--quiet is-invalid" tabindex="-1" aria-expanded="false" aria-haspopup="dialog" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
</div> | ||
|
||
<p /> | ||
|
||
<div aria-disabled="true" class="spectrum-InputGroup spectrum-InputGroup--quiet spectrum-Datepicker spectrum-Datepicker--range is-disabled" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-startField" placeholder="mm/dd/yyyy" name="start" value="2018-10-01" disabled> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-endField" placeholder="mm/dd/yyyy" name="end" value="2018-10-30" disabled> | ||
<button type="button" class="spectrum-FieldButton spectrum-FieldButton--quiet" tabindex="-1" disabled aria-expanded="false" aria-haspopup="dialog" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
</div> | ||
<p/> | ||
|
||
<div class="spectrum-InputGroup spectrum-InputGroup--quiet spectrum-Datepicker spectrum-Datepicker--range spectrum-Datepicker--datetimeRange" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-startField" aria-invalid="false" placeholder="mm/dd/yyyy hh:mm a" name="start" value=""> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-Textfield--quiet spectrum-InputGroup-field spectrum-Datepicker-endField" aria-invalid="false" placeholder="mm/dd/yyyy hh:mm a" name="end" value=""> | ||
<button type="button" class="spectrum-FieldButton spectrum-FieldButton--quiet" tabindex="-1" aria-expanded="false" aria-haspopup="dialog" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Date Picker - Range | ||
description: A date picker uses the input group component to display a field with a button next to it | ||
markup: | | ||
<div aria-invalid="false" class="spectrum-InputGroup spectrum-Datepicker spectrum-Datepicker--range" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-startField" placeholder="mm/dd/yyyy" name="start" value=""> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-endField" placeholder="mm/dd/yyyy" name="end" value=""> | ||
<button type="button" class="spectrum-FieldButton" tabindex="-1" aria-expanded="false" aria-haspopup="dialog" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
</div> | ||
|
||
<p/> | ||
|
||
<div aria-invalid="true" class="spectrum-InputGroup spectrum-Datepicker spectrum-Datepicker--range is-invalid" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-startField" aria-invalid="true" placeholder="mm/dd/yyyy" name="start" value=""> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-endField is-invalid" aria-invalid="true" placeholder="mm/dd/yyyy" name="end" value=""> | ||
<button type="button" class="spectrum-FieldButton is-invalid" tabindex="-1" aria-expanded="false" aria-haspopup="dialog" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
</div> | ||
|
||
<p/> | ||
|
||
<div aria-disabled="true" class="spectrum-InputGroup spectrum-Datepicker spectrum-Datepicker--range is-disabled" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-startField" placeholder="mm/dd/yyyy" name="start" value="" disabled> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-endField" placeholder="mm/dd/yyyy" name="end" value="" disabled> | ||
<button type="button" class="spectrum-FieldButton" disabled tabindex="-1" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
</div> | ||
|
||
<p/> | ||
|
||
<div class="spectrum-InputGroup spectrum-Datepicker spectrum-Datepicker--range spectrum-Datepicker--datetimeRange" role="combobox" aria-expanded="false" aria-haspopup="dialog"> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-startField" placeholder="mm/dd/yyyy hh:mm a" name="start" value=""> | ||
<div class="spectrum-Datepicker--rangeDash"></div> | ||
<input type="text" class="spectrum-Textfield spectrum-InputGroup-field spectrum-Datepicker-endField" placeholder="mm/dd/yyyy hh:mm a" name="end" value=""> | ||
<button type="button" class="spectrum-FieldButton" tabindex="-1" aria-expanded="false" aria-haspopup="dialog" aria-label="Calendar"> | ||
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true"> | ||
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" /> | ||
</svg> | ||
</button> | ||
<!-- To render focus ring around entire input group when one of the inputs has keyboard focus, we need this: --> | ||
<div class="spectrum-Datepicker-focusRing" role="presentation"></div> | ||
majornista marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> |
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
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.
Mmmm, this can't be done with
:before
/:after
? I don't see anything using those pseudo-elements right now.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.
@majornista oh, I see -- it's being selected with the sibling selector, so we can't use pseudo-elements. Perhaps, instead, we should be programmatically applying
.is-focused
to the outer.spectrum-Datepicker
and using:focus-within
(for futureproofing)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.
Only with additional javascript to check for
.focus-ring
className on a descendant element. And, we'd probably need an extra.focus-ring
state, to distinguish between mouse a keyboard focus. With the added element, the style can be applied with pure CSS.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.
Got it, so we would need to know "is a child element keyboard focused?" in JavaScript, and a separate class for keyboard vs mouse focus. @GarthDB thoughts on this? This is the first component that has anything like this.
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 prefer pure CSS for accessibility things like keyboard focus. It would be preferable to implement it with the same strategy as all the others, but I'm not seeing an obvious way to do that.
We could add something to the focus-ring polyfill, but that would kind of defeat the point of a standards-based polyfill.
The focus-withing strategy would be nice, it just means we're adding another polyfill requirement to focus. What would you prefer @lazd?
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.
Though I would prefer the polyfill, I don't want to hold up this PR. I agree with your sentiments and suppose I'm fine with the current approach.
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.
The Rating component has a similar issue with how the focus outline is applied to the wrapper element. Devon was somewhat resistant to the approach of evaluating for descendant input with
.focus-ring
. The difference for the Datepicker is that text inputs show blue border for mouse focus and border with box-shadow for keyboard focus.