Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
76df1348
Commit
76df1348
authored
Jun 10, 2016
by
Chris Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AC-484 removing aria-activedescendent
parent
df399de1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
52 deletions
+82
-52
lms/static/coffee/fixtures/calculator.html
+11
-10
lms/static/coffee/spec/calculator_spec.coffee
+1
-1
lms/static/coffee/src/calculator.coffee
+17
-7
lms/static/sass/course/modules/_calculator.scss
+13
-7
lms/templates/calculator/toggle_calculator.html
+40
-27
No files found.
lms/static/coffee/fixtures/calculator.html
View file @
76df1348
<ul>
<div
class=
"calc-main"
>
<li
class=
"calc-main"
>
<button
title=
"Open Calculator"
aria-controls=
"calculator_wrapper"
aria-expanded=
"false"
class=
"calc utility-control-button"
>
<a
href=
"#"
class=
"calc"
title=
"Open Calculator"
role=
"button"
aria-controls=
"calculator_wrapper"
aria-expanded=
"false"
>
Open Calculator
</a>
<span
class=
"icon fa fa-calculator"
aria-hidden=
"true"
></span>
</button>
<div
id=
"calculator_wrapper"
>
<div
id=
"calculator_wrapper"
>
<form
id=
"calculator"
>
<form
id=
"calculator"
>
<div
class=
"input-wrapper"
>
<div
class=
"input-wrapper"
>
<input
type=
"text"
id=
"calculator_input"
tabindex=
"-1"
/>
<input
type=
"text"
id=
"calculator_input"
tabindex=
"-1"
/>
<div
class=
"help-wrapper"
>
<div
class=
"help-wrapper"
>
<a
id=
"calculator_hint"
href=
"#"
role=
"button"
aria-haspopup=
"true"
tabindex=
"-1"
>
Hints
</a
>
<button
type=
"button"
id=
"calculator_hint"
aria-haspopup=
"true"
>
Hints
</button
>
<ul
id=
"calculator_input_help"
class=
"help"
aria-activedescenda
nt=
"hint-integers"
role=
"tooltip"
aria-hidden=
"true"
>
<ul
id=
"calculator_input_help"
class=
"help"
data-calculator-hi
nt=
"hint-integers"
role=
"tooltip"
aria-hidden=
"true"
>
<li
class=
"hint-item"
id=
"hint-moreinfo"
tabindex=
"-1"
>
<li
class=
"hint-item"
id=
"hint-moreinfo"
tabindex=
"-1"
>
<p>
<p>
<span
class=
"bold"
>
For detailed information, see
<span
class=
"bold"
>
For detailed information, see
...
@@ -17,13 +19,12 @@
...
@@ -17,13 +19,12 @@
</p>
</p>
</li>
</li>
<li
class=
"hint-item"
id=
"hint-integers"
tabindex=
"-1"
><p><span
class=
"bold"
>
Integers:
</span>
2520
</p></li>
<li
class=
"hint-item"
id=
"hint-integers"
tabindex=
"-1"
><p><span
class=
"bold"
>
Integers:
</span>
2520
</p></li>
<li
class=
"hint-item"
id=
"hint-decimals"
tabindex=
"-1"
><p><span
class=
"bold"
>
Decimals:
<
/span>
3.14 or .98
</p></li>
<li
class=
"hint-item"
id=
"hint-decimals"
tabindex=
"-1"
><p><span
class=
"bold"
>
Decimals:
/span> 3.14 or .98
</p></li>
</ul>
</ul>
</div>
</div>
</div>
</div>
<input
id=
"calculator_button"
type=
"submit"
title=
"Calculate"
arial-label=
"Calculate"
value=
"="
tabindex=
"-1
"
/>
<input
id=
"calculator_button"
type=
"submit"
title=
"Calculate"
value=
"=
"
/>
<input
type=
"text"
id=
"calculator_output"
readonly
tabindex=
"-1"
/>
<input
type=
"text"
id=
"calculator_output"
tabindex=
"-1"
readonly
/>
</form>
</form>
</div>
</div>
</li>
</div>
</ul>
lms/static/coffee/spec/calculator_spec.coffee
View file @
76df1348
...
@@ -105,7 +105,7 @@ describe 'Calculator', ->
...
@@ -105,7 +105,7 @@ describe 'Calculator', ->
expect
(
element
.
focus
).
toHaveBeenCalled
()
expect
(
element
.
focus
).
toHaveBeenCalled
()
expect
(
@
calculator
.
activeHint
).
toEqual
(
element
)
expect
(
@
calculator
.
activeHint
).
toEqual
(
element
)
expect
(
@
calculator
.
hintPopup
).
toHaveAttr
(
'
aria-activedescenda
nt'
,
element
.
attr
(
'id'
))
expect
(
@
calculator
.
hintPopup
).
toHaveAttr
(
'
data-calculator-hi
nt'
,
element
.
attr
(
'id'
))
it
'select the first hint if argument element is not passed'
,
->
it
'select the first hint if argument element is not passed'
,
->
@
calculator
.
selectHint
()
@
calculator
.
selectHint
()
...
...
lms/static/coffee/src/calculator.coffee
View file @
76df1348
...
@@ -14,13 +14,15 @@
...
@@ -14,13 +14,15 @@
class
@
Calculator
class
@
Calculator
constructor
:
->
constructor
:
->
@
hintButton
=
$
(
'#calculator_hint'
)
@
hintButton
=
$
(
'#calculator_hint'
)
@
calcInput
=
$
(
'#calculator_input'
)
@
hintPopup
=
$
(
'.help'
)
@
hintPopup
=
$
(
'.help'
)
@
hintsList
=
@
hintPopup
.
find
(
'.hint-item'
)
@
hintsList
=
@
hintPopup
.
find
(
'.hint-item'
)
@
selectHint
(
$
(
'#'
+
@
hintPopup
.
attr
(
'
aria-activedescenda
nt'
)));
@
selectHint
(
$
(
'#'
+
@
hintPopup
.
attr
(
'
data-calculator-hi
nt'
)));
$
(
'.calc'
).
click
@
toggle
$
(
'.calc'
).
click
@
toggle
$
(
'form#calculator'
).
submit
(
@
calculate
).
submit
(
e
)
->
$
(
'form#calculator'
).
submit
(
@
calculate
).
submit
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
@
hintButton
@
hintButton
.
click
((
$
.
proxy
(
@
handleClickOnHintButton
,
@
)))
.
click
((
$
.
proxy
(
@
handleClickOnHintButton
,
@
)))
...
@@ -35,6 +37,9 @@ class @Calculator
...
@@ -35,6 +37,9 @@ class @Calculator
@
handleClickOnDocument
=
$
.
proxy
(
@
handleClickOnDocument
,
@
)
@
handleClickOnDocument
=
$
.
proxy
(
@
handleClickOnDocument
,
@
)
@
calcInput
.
focus
((
$
.
proxy
(
@
inputClickHandler
,
@
)))
KEY
:
KEY
:
TAB
:
9
TAB
:
9
ENTER
:
13
ENTER
:
13
...
@@ -53,19 +58,17 @@ class @Calculator
...
@@ -53,19 +58,17 @@ class @Calculator
isExpanded
=
false
isExpanded
=
false
icon
=
'fa-calculator'
icon
=
'fa-calculator'
$
(
'
div
.calc-main'
).
toggleClass
'open'
$
(
'.calc-main'
).
toggleClass
'open'
if
$calc
.
hasClass
(
'closed'
)
if
$calc
.
hasClass
(
'closed'
)
$calcWrapper
$calcWrapper
.
find
(
'input, a'
)
.
attr
(
'aria-hidden'
,
'true'
)
.
attr
'tabindex'
,
-
1
else
else
text
=
gettext
(
'Close Calculator'
)
text
=
gettext
(
'Close Calculator'
)
icon
=
'fa-close'
icon
=
'fa-close'
isExpanded
=
true
isExpanded
=
true
$calcWrapper
$calcWrapper
.
find
(
'input, a'
)
.
attr
(
'aria-hidden'
,
'false'
)
.
attr
'tabindex'
,
0
# TODO: Investigate why doing this without the timeout causes it to jump
# TODO: Investigate why doing this without the timeout causes it to jump
# down to the bottom of the page. I suspect it's because it's putting the
# down to the bottom of the page. I suspect it's because it's putting the
# focus on the text field before it transitions onto the page.
# focus on the text field before it transitions onto the page.
...
@@ -85,11 +88,15 @@ class @Calculator
...
@@ -85,11 +88,15 @@ class @Calculator
$calc
.
toggleClass
'closed'
$calc
.
toggleClass
'closed'
inputClickHandler
:
->
$
(
'#calculator_output'
).
removeClass
(
'has-result'
)
showHint
:
->
showHint
:
->
@
hintPopup
@
hintPopup
.
addClass
(
'shown'
)
.
addClass
(
'shown'
)
.
attr
(
'aria-hidden'
,
false
)
.
attr
(
'aria-hidden'
,
false
)
$
(
'#calculator_output'
).
removeClass
(
'has-result'
)
$
(
document
).
on
(
'click'
,
@
handleClickOnDocument
)
$
(
document
).
on
(
'click'
,
@
handleClickOnDocument
)
...
@@ -98,6 +105,8 @@ class @Calculator
...
@@ -98,6 +105,8 @@ class @Calculator
.
removeClass
(
'shown'
)
.
removeClass
(
'shown'
)
.
attr
(
'aria-hidden'
,
true
)
.
attr
(
'aria-hidden'
,
true
)
$
(
'#calculator_output'
).
removeClass
(
'has-result'
)
$
(
document
).
off
(
'click'
,
@
handleClickOnDocument
)
$
(
document
).
off
(
'click'
,
@
handleClickOnDocument
)
selectHint
:
(
element
)
->
selectHint
:
(
element
)
->
...
@@ -106,7 +115,7 @@ class @Calculator
...
@@ -106,7 +115,7 @@ class @Calculator
@
activeHint
=
element
;
@
activeHint
=
element
;
@
activeHint
.
focus
();
@
activeHint
.
focus
();
@
hintPopup
.
attr
(
'
aria-activedescenda
nt'
,
element
.
attr
(
'id'
));
@
hintPopup
.
attr
(
'
data-calculator-hi
nt'
,
element
.
attr
(
'id'
));
prevHint
:
()
->
prevHint
:
()
->
prev
=
@
activeHint
.
prev
();
# the previous hint
prev
=
@
activeHint
.
prev
();
# the previous hint
...
@@ -211,4 +220,5 @@ class @Calculator
...
@@ -211,4 +220,5 @@ class @Calculator
$
.
getWithPrefix
'/calculate'
,
{
equation
:
$
(
'#calculator_input'
).
val
()
},
(
data
)
->
$
.
getWithPrefix
'/calculate'
,
{
equation
:
$
(
'#calculator_input'
).
val
()
},
(
data
)
->
$
(
'#calculator_output'
)
$
(
'#calculator_output'
)
.
val
(
data
.
result
)
.
val
(
data
.
result
)
.
addClass
(
'has-result'
)
.
focus
()
.
focus
()
lms/static/sass/course/modules/_calculator.scss
View file @
76df1348
...
@@ -70,12 +70,12 @@
...
@@ -70,12 +70,12 @@
}
}
#calculator_button
{
#calculator_button
{
background
:
#111
;
background
:
$white
;
border
:
1px
solid
$
black
;
border
:
1px
solid
$
white
;
border-radius
:
0
;
border-radius
:
0
;
box-shadow
:
none
;
box-shadow
:
none
;
@include
box-sizing
(
border-box
);
@include
box-sizing
(
border-box
);
color
:
$
white
;
color
:
$
black
;
float
:
left
;
float
:
left
;
font-size
:
30px
;
font-size
:
30px
;
font-weight
:
bold
;
font-weight
:
bold
;
...
@@ -87,7 +87,8 @@
...
@@ -87,7 +87,8 @@
width
:
flex-grid
(
.5
)
+
flex-gutter
();
width
:
flex-grid
(
.5
)
+
flex-gutter
();
&
:hover
,
&
:focus
{
&
:hover
,
&
:focus
{
color
:
$link-color
;
background
:
$blue-d2
;
color
:
$white
;
}
}
.calc-button-label
{
.calc-button-label
{
...
@@ -97,11 +98,11 @@
...
@@ -97,11 +98,11 @@
}
}
#calculator_output
{
#calculator_output
{
background
:
#111
;
background
:
$white
;
border
:
0
;
border
:
1px
solid
$white
;
box-shadow
:
none
;
box-shadow
:
none
;
@include
box-sizing
(
border-box
);
@include
box-sizing
(
border-box
);
color
:
$
white
;
color
:
$
black
;
float
:
left
;
float
:
left
;
font-size
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
font-weight
:
bold
;
...
@@ -109,6 +110,11 @@
...
@@ -109,6 +110,11 @@
padding
:
10px
;
padding
:
10px
;
-webkit-appearance
:
none
;
-webkit-appearance
:
none
;
width
:
flex-grid
(
4
);
width
:
flex-grid
(
4
);
&
.has-result
{
border
:
1px
solid
$green-d1
;
box-shadow
:
inset
0px
0px
(
$baseline
/
3
)
$green-d1
;
}
}
}
.input-wrapper
{
.input-wrapper
{
...
...
lms/templates/calculator/toggle_calculator.html
View file @
76df1348
This diff is collapsed.
Click to expand it.
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