Skip to content

Commit d348882

Browse files
committed
Merge pull request #28725 from brave/emerick-hide-image-labels-accessibility-toggle
Hide the image labels toggle button in brave://settings/accessibility
1 parent dc322c4 commit d348882

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

browser/resources/settings/brave_overrides/a11y_page.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,35 @@
33
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
44
// You can obtain one at https://mozilla.org/MPL/2.0/.
55

6-
import { RegisterPolymerTemplateModifications } from 'chrome://resources/brave/polymer_overriding.js'
6+
import {
7+
RegisterPolymerTemplateModifications
8+
} from 'chrome://resources/brave/polymer_overriding.js'
79

810
RegisterPolymerTemplateModifications({
911
'settings-a11y-page': (templateContent) => {
12+
1013
// We remove all the templates related to captions - there are two modes
1114
// depending on whether `captionSettingsOpensExternally_` is set. We remove
1215
// both.
13-
const captionsLinkTemplates = templateContent.querySelectorAll('template[if*="captionSettingsOpensExternally_"]')
16+
const captionsLinkTemplates = templateContent.
17+
querySelectorAll('template[if*="captionSettingsOpensExternally_"]')
1418
if (captionsLinkTemplates.length !== 3) {
15-
console.error(`Expected 3 captionsLinkTemplates, got ${captionsLinkTemplates.length} - this indicates something upstream has changed. The override may need to be updated.`)
19+
console.error(
20+
`Expected 3 captionsLinkTemplates, got ${captionsLinkTemplates.length}`
21+
+ ' - this indicates something upstream has changed.'
22+
+ ' The override may need to be updated.')
1623
}
1724
for (const link of captionsLinkTemplates) {
1825
link.remove()
1926
}
27+
28+
// We hide the image labels toggle button as we don't support this service
29+
const imageLabelsToggle = templateContent.querySelector(
30+
'settings-toggle-button[on-change="onA11yImageLabelsChange_"]')
31+
if (imageLabelsToggle) {
32+
imageLabelsToggle.setAttribute('hidden', 'true')
33+
} else {
34+
console.error('[Settings] missing image labels toggle button')
35+
}
2036
}
2137
})

0 commit comments

Comments
 (0)