Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
i20rzslider
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jedife
i20rzslider
Commits
7a3b398b
Commit
7a3b398b
authored
Dec 06, 2015
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add aria role and aria-value attributes
parent
c812f4dd
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
31 deletions
+103
-31
rzslider.js
dist/rzslider.js
+51
-15
rzslider.min.js
dist/rzslider.min.js
+1
-1
rzslider.js
src/rzslider.js
+51
-15
No files found.
dist/rzslider.js
View file @
7a3b398b
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
ticksValuesTooltip
:
null
,
ticksValuesTooltip
:
null
,
vertical
:
false
,
vertical
:
false
,
selectionBarColor
:
null
,
selectionBarColor
:
null
,
keyboardSupport
:
true
,
scale
:
1
,
scale
:
1
,
onStart
:
null
,
onStart
:
null
,
onChange
:
null
,
onChange
:
null
,
...
@@ -310,6 +311,7 @@
...
@@ -310,6 +311,7 @@
self
.
updateLowHandle
(
self
.
valueToOffset
(
self
.
scope
.
rzSliderModel
));
self
.
updateLowHandle
(
self
.
valueToOffset
(
self
.
scope
.
rzSliderModel
));
self
.
updateSelectionBar
();
self
.
updateSelectionBar
();
self
.
updateTicksScale
();
self
.
updateTicksScale
();
self
.
updateAriaAttributes
();
if
(
self
.
range
)
{
if
(
self
.
range
)
{
self
.
updateCmbLabel
();
self
.
updateCmbLabel
();
...
@@ -323,6 +325,7 @@
...
@@ -323,6 +325,7 @@
self
.
updateSelectionBar
();
self
.
updateSelectionBar
();
self
.
updateTicksScale
();
self
.
updateTicksScale
();
self
.
updateCmbLabel
();
self
.
updateCmbLabel
();
self
.
updateAriaAttributes
();
},
self
.
options
.
interval
);
},
self
.
options
.
interval
);
this
.
scope
.
$on
(
'rzSliderForceRender'
,
function
()
{
this
.
scope
.
$on
(
'rzSliderForceRender'
,
function
()
{
...
@@ -614,14 +617,43 @@
...
@@ -614,14 +617,43 @@
},
},
/**
/**
* Adds accessibility atributes
* Adds accessibility at
t
ributes
*
*
* Run only once during initialization
* Run only once during initialization
*
*
* @returns {undefined}
* @returns {undefined}
*/
*/
addAccessibility
:
function
()
{
addAccessibility
:
function
()
{
this
.
sliderElem
.
attr
(
"role"
,
"slider"
);
this
.
minH
.
attr
(
'role'
,
'slider'
);
this
.
updateAriaAttributes
();
if
(
this
.
options
.
keyboardSupport
)
this
.
minH
.
attr
(
'tabindex'
,
'0'
);
if
(
this
.
options
.
vertical
)
this
.
minH
.
attr
(
'aria-orientation'
,
'vertical'
);
if
(
this
.
range
)
{
this
.
maxH
.
attr
(
'role'
,
'slider'
);
if
(
this
.
options
.
keyboardSupport
)
this
.
maxH
.
attr
(
'tabindex'
,
'0'
);
if
(
this
.
options
.
vertical
)
this
.
maxH
.
attr
(
'aria-orientation'
,
'vertical'
);
}
},
/**
* Updates aria attributes according to current values
*/
updateAriaAttributes
:
function
()
{
this
.
minH
.
attr
(
'aria-valuenow'
,
this
.
scope
.
rzSliderModel
);
this
.
minH
.
attr
(
'aria-valuetext'
,
this
.
customTrFn
(
this
.
scope
.
rzSliderModel
));
this
.
minH
.
attr
(
'aria-valuemin'
,
this
.
minValue
);
this
.
minH
.
attr
(
'aria-valuemax'
,
this
.
maxValue
);
if
(
this
.
range
)
{
this
.
maxH
.
attr
(
'aria-valuenow'
,
this
.
scope
.
rzSliderHigh
);
this
.
maxH
.
attr
(
'aria-valuetext'
,
this
.
customTrFn
(
this
.
scope
.
rzSliderHigh
));
this
.
maxH
.
attr
(
'aria-valuemin'
,
this
.
minValue
);
this
.
maxH
.
attr
(
'aria-valuemax'
,
this
.
maxValue
);
}
},
},
/**
/**
...
@@ -1126,10 +1158,12 @@
...
@@ -1126,10 +1158,12 @@
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onStart
,
null
,
null
));
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onStart
,
null
,
null
));
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
));
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
));
if
(
this
.
options
.
keyboardSupport
)
{
this
.
minH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
minH
,
'rzSliderModel'
))
this
.
minH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
minH
,
'rzSliderModel'
))
if
(
this
.
range
)
{
if
(
this
.
range
)
{
this
.
maxH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
maxH
,
'rzSliderHigh'
));
this
.
maxH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
maxH
,
'rzSliderHigh'
));
}
}
}
},
},
/**
/**
...
@@ -1172,6 +1206,8 @@
...
@@ -1172,6 +1206,8 @@
}
}
pointer
.
addClass
(
'rz-active'
);
pointer
.
addClass
(
'rz-active'
);
if
(
this
.
options
.
keyboardSupport
)
pointer
[
0
].
focus
();
pointer
[
0
].
focus
();
ehMove
=
angular
.
bind
(
this
,
this
.
dragging
.
active
?
this
.
onDragMove
:
this
.
onMove
,
pointer
);
ehMove
=
angular
.
bind
(
this
,
this
.
dragging
.
active
?
this
.
onDragMove
:
this
.
onMove
,
pointer
);
...
@@ -1221,29 +1257,26 @@
...
@@ -1221,29 +1257,26 @@
onEnd
:
function
(
ehMove
,
event
)
{
onEnd
:
function
(
ehMove
,
event
)
{
var
moveEventName
=
this
.
getEventNames
(
event
).
moveEvent
;
var
moveEventName
=
this
.
getEventNames
(
event
).
moveEvent
;
//this.minH.removeClass('rz-active');
if
(
!
this
.
options
.
keyboardSupport
)
{
//this.maxH.removeClass('rz-active');
this
.
minH
.
removeClass
(
'rz-active'
);
this
.
maxH
.
removeClass
(
'rz-active'
);
this
.
tracking
=
''
;
}
this
.
dragging
.
active
=
false
;
$document
.
off
(
moveEventName
,
ehMove
);
$document
.
off
(
moveEventName
,
ehMove
);
this
.
scope
.
$emit
(
'slideEnded'
);
this
.
scope
.
$emit
(
'slideEnded'
);
//this.tracking = '';
this
.
dragging
.
active
=
false
;
this
.
callOnEnd
();
this
.
callOnEnd
();
},
},
onPointerFocus
:
function
(
pointer
,
ref
,
event
)
{
onPointerFocus
:
function
(
pointer
,
ref
,
event
)
{
//if (this.tracking === ref) return;
this
.
tracking
=
ref
;
this
.
tracking
=
ref
;
console
.
info
(
'focused'
,
ref
);
pointer
.
one
(
'blur'
,
angular
.
bind
(
this
,
this
.
onPointerBlur
,
pointer
));
pointer
.
one
(
'blur'
,
angular
.
bind
(
this
,
this
.
onPointerBlur
,
pointer
));
pointer
.
on
(
'keydown'
,
angular
.
bind
(
this
,
this
.
onKeyboardEvent
));
pointer
.
on
(
'keydown'
,
angular
.
bind
(
this
,
this
.
onKeyboardEvent
));
pointer
.
addClass
(
'rz-active'
);
pointer
.
addClass
(
'rz-active'
);
},
},
onPointerBlur
:
function
(
pointer
,
event
)
{
onPointerBlur
:
function
(
pointer
,
event
)
{
console
.
info
(
'blured'
,
this
.
tracking
);
pointer
.
off
(
'keydown'
);
pointer
.
off
(
'keydown'
);
this
.
tracking
=
''
;
this
.
tracking
=
''
;
pointer
.
removeClass
(
'rz-active'
);
pointer
.
removeClass
(
'rz-active'
);
...
@@ -1386,6 +1419,7 @@
...
@@ -1386,6 +1419,7 @@
switched
=
true
;
switched
=
true
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderHigh
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderHigh
;
this
.
updateHandles
(
this
.
tracking
,
this
.
maxH
.
rzsp
);
this
.
updateHandles
(
this
.
tracking
,
this
.
maxH
.
rzsp
);
this
.
updateAriaAttributes
();
this
.
tracking
=
'rzSliderHigh'
;
this
.
tracking
=
'rzSliderHigh'
;
this
.
minH
.
removeClass
(
'rz-active'
);
this
.
minH
.
removeClass
(
'rz-active'
);
this
.
maxH
.
addClass
(
'rz-active'
);
this
.
maxH
.
addClass
(
'rz-active'
);
...
@@ -1394,6 +1428,7 @@
...
@@ -1394,6 +1428,7 @@
switched
=
true
;
switched
=
true
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderModel
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderModel
;
this
.
updateHandles
(
this
.
tracking
,
this
.
minH
.
rzsp
);
this
.
updateHandles
(
this
.
tracking
,
this
.
minH
.
rzsp
);
this
.
updateAriaAttributes
();
this
.
tracking
=
'rzSliderModel'
;
this
.
tracking
=
'rzSliderModel'
;
this
.
maxH
.
removeClass
(
'rz-active'
);
this
.
maxH
.
removeClass
(
'rz-active'
);
this
.
minH
.
addClass
(
'rz-active'
);
this
.
minH
.
addClass
(
'rz-active'
);
...
@@ -1404,6 +1439,7 @@
...
@@ -1404,6 +1439,7 @@
if
(
this
.
scope
[
this
.
tracking
]
!==
newValue
)
{
if
(
this
.
scope
[
this
.
tracking
]
!==
newValue
)
{
this
.
scope
[
this
.
tracking
]
=
newValue
;
this
.
scope
[
this
.
tracking
]
=
newValue
;
this
.
updateHandles
(
this
.
tracking
,
newOffset
);
this
.
updateHandles
(
this
.
tracking
,
newOffset
);
this
.
updateAriaAttributes
();
valueChanged
=
true
;
valueChanged
=
true
;
}
}
...
...
dist/rzslider.min.js
View file @
7a3b398b
This diff is collapsed.
Click to expand it.
src/rzslider.js
View file @
7a3b398b
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
ticksValuesTooltip
:
null
,
ticksValuesTooltip
:
null
,
vertical
:
false
,
vertical
:
false
,
selectionBarColor
:
null
,
selectionBarColor
:
null
,
keyboardSupport
:
true
,
scale
:
1
,
scale
:
1
,
onStart
:
null
,
onStart
:
null
,
onChange
:
null
,
onChange
:
null
,
...
@@ -310,6 +311,7 @@
...
@@ -310,6 +311,7 @@
self
.
updateLowHandle
(
self
.
valueToOffset
(
self
.
scope
.
rzSliderModel
));
self
.
updateLowHandle
(
self
.
valueToOffset
(
self
.
scope
.
rzSliderModel
));
self
.
updateSelectionBar
();
self
.
updateSelectionBar
();
self
.
updateTicksScale
();
self
.
updateTicksScale
();
self
.
updateAriaAttributes
();
if
(
self
.
range
)
{
if
(
self
.
range
)
{
self
.
updateCmbLabel
();
self
.
updateCmbLabel
();
...
@@ -323,6 +325,7 @@
...
@@ -323,6 +325,7 @@
self
.
updateSelectionBar
();
self
.
updateSelectionBar
();
self
.
updateTicksScale
();
self
.
updateTicksScale
();
self
.
updateCmbLabel
();
self
.
updateCmbLabel
();
self
.
updateAriaAttributes
();
},
self
.
options
.
interval
);
},
self
.
options
.
interval
);
this
.
scope
.
$on
(
'rzSliderForceRender'
,
function
()
{
this
.
scope
.
$on
(
'rzSliderForceRender'
,
function
()
{
...
@@ -614,14 +617,43 @@
...
@@ -614,14 +617,43 @@
},
},
/**
/**
* Adds accessibility atributes
* Adds accessibility at
t
ributes
*
*
* Run only once during initialization
* Run only once during initialization
*
*
* @returns {undefined}
* @returns {undefined}
*/
*/
addAccessibility
:
function
()
{
addAccessibility
:
function
()
{
this
.
sliderElem
.
attr
(
"role"
,
"slider"
);
this
.
minH
.
attr
(
'role'
,
'slider'
);
this
.
updateAriaAttributes
();
if
(
this
.
options
.
keyboardSupport
)
this
.
minH
.
attr
(
'tabindex'
,
'0'
);
if
(
this
.
options
.
vertical
)
this
.
minH
.
attr
(
'aria-orientation'
,
'vertical'
);
if
(
this
.
range
)
{
this
.
maxH
.
attr
(
'role'
,
'slider'
);
if
(
this
.
options
.
keyboardSupport
)
this
.
maxH
.
attr
(
'tabindex'
,
'0'
);
if
(
this
.
options
.
vertical
)
this
.
maxH
.
attr
(
'aria-orientation'
,
'vertical'
);
}
},
/**
* Updates aria attributes according to current values
*/
updateAriaAttributes
:
function
()
{
this
.
minH
.
attr
(
'aria-valuenow'
,
this
.
scope
.
rzSliderModel
);
this
.
minH
.
attr
(
'aria-valuetext'
,
this
.
customTrFn
(
this
.
scope
.
rzSliderModel
));
this
.
minH
.
attr
(
'aria-valuemin'
,
this
.
minValue
);
this
.
minH
.
attr
(
'aria-valuemax'
,
this
.
maxValue
);
if
(
this
.
range
)
{
this
.
maxH
.
attr
(
'aria-valuenow'
,
this
.
scope
.
rzSliderHigh
);
this
.
maxH
.
attr
(
'aria-valuetext'
,
this
.
customTrFn
(
this
.
scope
.
rzSliderHigh
));
this
.
maxH
.
attr
(
'aria-valuemin'
,
this
.
minValue
);
this
.
maxH
.
attr
(
'aria-valuemax'
,
this
.
maxValue
);
}
},
},
/**
/**
...
@@ -1126,10 +1158,12 @@
...
@@ -1126,10 +1158,12 @@
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onStart
,
null
,
null
));
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onStart
,
null
,
null
));
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
));
this
.
ticks
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
));
if
(
this
.
options
.
keyboardSupport
)
{
this
.
minH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
minH
,
'rzSliderModel'
))
this
.
minH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
minH
,
'rzSliderModel'
))
if
(
this
.
range
)
{
if
(
this
.
range
)
{
this
.
maxH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
maxH
,
'rzSliderHigh'
));
this
.
maxH
.
on
(
'focus'
,
angular
.
bind
(
this
,
this
.
onPointerFocus
,
this
.
maxH
,
'rzSliderHigh'
));
}
}
}
},
},
/**
/**
...
@@ -1172,6 +1206,8 @@
...
@@ -1172,6 +1206,8 @@
}
}
pointer
.
addClass
(
'rz-active'
);
pointer
.
addClass
(
'rz-active'
);
if
(
this
.
options
.
keyboardSupport
)
pointer
[
0
].
focus
();
pointer
[
0
].
focus
();
ehMove
=
angular
.
bind
(
this
,
this
.
dragging
.
active
?
this
.
onDragMove
:
this
.
onMove
,
pointer
);
ehMove
=
angular
.
bind
(
this
,
this
.
dragging
.
active
?
this
.
onDragMove
:
this
.
onMove
,
pointer
);
...
@@ -1221,29 +1257,26 @@
...
@@ -1221,29 +1257,26 @@
onEnd
:
function
(
ehMove
,
event
)
{
onEnd
:
function
(
ehMove
,
event
)
{
var
moveEventName
=
this
.
getEventNames
(
event
).
moveEvent
;
var
moveEventName
=
this
.
getEventNames
(
event
).
moveEvent
;
//this.minH.removeClass('rz-active');
if
(
!
this
.
options
.
keyboardSupport
)
{
//this.maxH.removeClass('rz-active');
this
.
minH
.
removeClass
(
'rz-active'
);
this
.
maxH
.
removeClass
(
'rz-active'
);
this
.
tracking
=
''
;
}
this
.
dragging
.
active
=
false
;
$document
.
off
(
moveEventName
,
ehMove
);
$document
.
off
(
moveEventName
,
ehMove
);
this
.
scope
.
$emit
(
'slideEnded'
);
this
.
scope
.
$emit
(
'slideEnded'
);
//this.tracking = '';
this
.
dragging
.
active
=
false
;
this
.
callOnEnd
();
this
.
callOnEnd
();
},
},
onPointerFocus
:
function
(
pointer
,
ref
,
event
)
{
onPointerFocus
:
function
(
pointer
,
ref
,
event
)
{
//if (this.tracking === ref) return;
this
.
tracking
=
ref
;
this
.
tracking
=
ref
;
console
.
info
(
'focused'
,
ref
);
pointer
.
one
(
'blur'
,
angular
.
bind
(
this
,
this
.
onPointerBlur
,
pointer
));
pointer
.
one
(
'blur'
,
angular
.
bind
(
this
,
this
.
onPointerBlur
,
pointer
));
pointer
.
on
(
'keydown'
,
angular
.
bind
(
this
,
this
.
onKeyboardEvent
));
pointer
.
on
(
'keydown'
,
angular
.
bind
(
this
,
this
.
onKeyboardEvent
));
pointer
.
addClass
(
'rz-active'
);
pointer
.
addClass
(
'rz-active'
);
},
},
onPointerBlur
:
function
(
pointer
,
event
)
{
onPointerBlur
:
function
(
pointer
,
event
)
{
console
.
info
(
'blured'
,
this
.
tracking
);
pointer
.
off
(
'keydown'
);
pointer
.
off
(
'keydown'
);
this
.
tracking
=
''
;
this
.
tracking
=
''
;
pointer
.
removeClass
(
'rz-active'
);
pointer
.
removeClass
(
'rz-active'
);
...
@@ -1386,6 +1419,7 @@
...
@@ -1386,6 +1419,7 @@
switched
=
true
;
switched
=
true
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderHigh
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderHigh
;
this
.
updateHandles
(
this
.
tracking
,
this
.
maxH
.
rzsp
);
this
.
updateHandles
(
this
.
tracking
,
this
.
maxH
.
rzsp
);
this
.
updateAriaAttributes
();
this
.
tracking
=
'rzSliderHigh'
;
this
.
tracking
=
'rzSliderHigh'
;
this
.
minH
.
removeClass
(
'rz-active'
);
this
.
minH
.
removeClass
(
'rz-active'
);
this
.
maxH
.
addClass
(
'rz-active'
);
this
.
maxH
.
addClass
(
'rz-active'
);
...
@@ -1394,6 +1428,7 @@
...
@@ -1394,6 +1428,7 @@
switched
=
true
;
switched
=
true
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderModel
;
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderModel
;
this
.
updateHandles
(
this
.
tracking
,
this
.
minH
.
rzsp
);
this
.
updateHandles
(
this
.
tracking
,
this
.
minH
.
rzsp
);
this
.
updateAriaAttributes
();
this
.
tracking
=
'rzSliderModel'
;
this
.
tracking
=
'rzSliderModel'
;
this
.
maxH
.
removeClass
(
'rz-active'
);
this
.
maxH
.
removeClass
(
'rz-active'
);
this
.
minH
.
addClass
(
'rz-active'
);
this
.
minH
.
addClass
(
'rz-active'
);
...
@@ -1404,6 +1439,7 @@
...
@@ -1404,6 +1439,7 @@
if
(
this
.
scope
[
this
.
tracking
]
!==
newValue
)
{
if
(
this
.
scope
[
this
.
tracking
]
!==
newValue
)
{
this
.
scope
[
this
.
tracking
]
=
newValue
;
this
.
scope
[
this
.
tracking
]
=
newValue
;
this
.
updateHandles
(
this
.
tracking
,
newOffset
);
this
.
updateHandles
(
this
.
tracking
,
newOffset
);
this
.
updateAriaAttributes
();
valueChanged
=
true
;
valueChanged
=
true
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment