Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
d79887fe
Commit
d79887fe
authored
Aug 23, 2023
by
henry
Committed by
Beatriz Rizental
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Customize moz-toggle for tor-browser.
parent
b978cfbe
No related branches found
No related tags found
1 merge request
!1527
Bug 43808: Rebase 128.10.1 onto 128.11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit/content/widgets/moz-toggle/moz-toggle.mjs
+18
-1
18 additions, 1 deletion
toolkit/content/widgets/moz-toggle/moz-toggle.mjs
with
18 additions
and
1 deletion
toolkit/content/widgets/moz-toggle/moz-toggle.mjs
+
18
−
1
View file @
d79887fe
...
...
@@ -34,6 +34,10 @@ export default class MozToggle extends MozLitElement {
description
:
{
type
:
String
},
ariaLabel
:
{
type
:
String
,
attribute
:
"
aria-label
"
},
accessKey
:
{
type
:
String
,
attribute
:
"
accesskey
"
},
// Extension for tor-browser. Used for tor-browser#41333.
title
:
{
type
:
String
,
attribute
:
"
title
"
},
// Extension for tor-browser. Used for tor-browser#40837.
labelAlignAfter
:
{
type
:
Boolean
,
attribute
:
"
label-align-after
"
},
};
static
get
queries
()
{
...
...
@@ -86,6 +90,12 @@ export default class MozToggle extends MozLitElement {
buttonTemplate
()
{
const
{
pressed
,
disabled
,
description
,
ariaLabel
,
handleClick
}
=
this
;
// For tor-browser, if we have a title we use it as the aria-description.
// Used for tor-browser#41333.
// Only set the description using the title if it differs from the
// accessible name derived from the label.
const
label
=
ariaLabel
||
this
.
label
;
const
ariaDescription
=
label
===
this
.
title
?
undefined
:
this
.
title
;
return
html
`
<button
id="moz-toggle-button"
...
...
@@ -95,6 +105,7 @@ export default class MozToggle extends MozLitElement {
?disabled=
${
disabled
}
aria-pressed=
${
pressed
}
aria-label=
${
ifDefined
(
ariaLabel
??
undefined
)}
aria-description=
${
ifDefined
(
ariaDescription
??
undefined
)}
aria-describedby=
${
ifDefined
(
description
?
"
moz-toggle-description
"
:
undefined
)}
...
...
@@ -104,6 +115,11 @@ export default class MozToggle extends MozLitElement {
}
render
()
{
// For tor-browser, we want to be able to place the label after the toggle
// as well.
// Used for the enable-bridges switch tor-browser#40837.
const
labelAlignAfter
=
this
.
labelAlignAfter
;
return
html
`
<link
rel="stylesheet"
...
...
@@ -118,11 +134,12 @@ export default class MozToggle extends MozLitElement {
for="moz-toggle-button"
accesskey=
${
ifDefined
(
this
.
accessKey
)}
>
${
labelAlignAfter
?
this
.
buttonTemplate
()
:
""
}
<span>
${
this
.
label
}
${
!
this
.
description
?
this
.
supportLinkTemplate
()
:
""
}
</span>
${
this
.
buttonTemplate
()}
${
labelAlignAfter
?
""
:
this
.
buttonTemplate
()}
</label>
`
:
this
.
buttonTemplate
()}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment