Skip to content

Commit

Permalink
Fix: add scale context to slider start and end labels (fixes #82) (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirsty-hames authored Apr 3, 2023
1 parent 0fde822 commit d40a881
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
20 changes: 12 additions & 8 deletions properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,23 @@
"translatable": true
},
"labelStart": {
"type": "number",
"required": true,
"default": "1",
"inputType": "Number",
"type": "string",
"required": false,
"default": "Start of the scale",
"title": "Scale Label - start aria label",
"inputType": "Text",
"validators": [],
"help": "Aria label for the start of the slider scale",
"translatable": true
},
"labelEnd": {
"type": "number",
"required": true,
"default": "1",
"inputType": "Number",
"type": "string",
"required": false,
"default": "End of the scale",
"title": "Scale Label - end aria label",
"inputType": "Text",
"validators": [],
"help": "Aria label for the end of the slider scale",
"translatable": true
}
},
Expand Down
16 changes: 16 additions & 0 deletions schema/course.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
"_adapt": {
"translatable": true
}
},
"labelStart": {
"type": "string",
"title": "Scale start ARIA label",
"default": "Start of the scale",
"_adapt": {
"translatable": true
}
},
"labelEnd": {
"type": "string",
"title": "Scale end ARIA label",
"default": "End of the scale",
"_adapt": {
"translatable": true
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions templates/confidenceSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ export default function ConfidenceSlider (props) {
<div className="slider__label-container js-slider-label-container">

{labelStart &&
<div className="slider__label-start" aria-label={_globals._components._confidenceSlider.labelStart}>
<div className="slider__label-start">
<div className="slider__label-start-inner">
<span className="aria-label">{_globals._components._confidenceSlider.labelStart} {_scaleStart}</span>
{labelStart}
</div>
</div>
}

{labelEnd &&
<div className="slider__label-end" aria-label={_globals._components._confidenceSlider.labelEnd}>
<div className="slider__label-end">
<div className="slider__label-end-inner">
<span className="aria-label">{_globals._components._confidenceSlider.labelEnd} {_scaleEnd}</span>
{labelEnd}
</div>
</div>
Expand Down

0 comments on commit d40a881

Please sign in to comment.