-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
335 additions
and
243 deletions.
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,10 @@ | ||
## Implementation | ||
|
||
Both thumbs have a `role` of `slider`, which needs an accessible label. By default, they use a localized version of "min" and "max". | ||
You can change the labels by setting the `aria-start-label` and `aria-end-label` attributes. | ||
|
||
Vivid automatically sets the `aria-valuetext` attribute on the thumbs. The attribute is read by assistive technology. You can control its format using the `valueTextFormatter` property for a more human-readable value. | ||
|
||
## Resources | ||
|
||
- [Vivid Tabs: Manual accessibility test](https://docs.google.com/spreadsheets/d/15J0sHxVUlmjv7HwT2b0gGNJFP_vsjAByzgRP_4oWYKk/edit?gid=1175911860#gid=1175911860) |
Empty file.
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,43 @@ | ||
```html preview | ||
<div> | ||
<vwc-range-slider | ||
id="slider" | ||
min="0" | ||
max="7200" | ||
end="7200" | ||
step="15" | ||
></vwc-range-slider> | ||
</div> | ||
<div> | ||
Duration from | ||
<strong> | ||
<span id="start"></span> | ||
to | ||
<span id="end"></span> | ||
</strong> | ||
</div> | ||
<script> | ||
const slider = document.querySelector('#slider'); | ||
const start = document.querySelector('#start'); | ||
const end = document.querySelector('#end'); | ||
const formatValue = (value) => { | ||
const totalSeconds = Number.parseFloat(value); | ||
const hours = Math.floor(totalSeconds / 3600); | ||
const minutes = Math.floor((totalSeconds % 3600) / 60); | ||
const seconds = Math.floor(totalSeconds % 60); | ||
return `${hours.toString().padStart(2, '0')}:${minutes | ||
.toString() | ||
.padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; | ||
}; | ||
const updateDescription = () => { | ||
start.innerText = formatValue(slider.start); | ||
end.innerText = formatValue(slider.end); | ||
}; | ||
customElements.whenDefined('vwc-range-slider').then(updateDescription); | ||
slider.valueTextFormatter = formatValue; | ||
slider.addEventListener('change', updateDescription); | ||
</script> | ||
``` |
Oops, something went wrong.