Skip to content

Commit 13dfb41

Browse files
ENH Hide PHP font icons from screen readers (#1381)
1 parent b9fab3d commit 13dfb41

6 files changed

Lines changed: 17 additions & 18 deletions

File tree

client/dist/js/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/components/ElementEditor/AddElementPopover.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ class AddElementPopover extends Component {
8484
);
8585

8686
const buttons = elementTypes.map((elementType) => ({
87-
content: elementType.title,
87+
content: <span className="btn__title">{elementType.title}</span>,
8888
key: elementType.name,
89-
className: classNames(elementType.icon, 'btn--icon-xl', 'element-editor-add-element__button'),
89+
className: classNames('btn--icon-xl', 'element-editor-add-element__button'),
90+
icon: elementType.icon.replace(/^(font-icon-)/g, ''),
9091
onClick: this.getElementButtonClickHandler(elementType),
9192
}));
9293

templates/DNADesign/Elemental/Models/BaseElement/PreviewIcon.ss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% if $IconClass %>
2-
<i class="$IconClass"></i>
2+
<span class="$IconClass" aria-hidden="true"></span>
33
<% end_if %>
44

55
<% if $IsVersioned && $VersionState %>

tests/Behat/features/change-tracking.feature

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,33 @@ Feature: Unsaved changes are identified by changetracker
1515
# Note we can't just check for "Save" vs "Saved" because one is a subset of the other,
1616
# so `I should not see a "Save" button` will always fail when the "Saved" button is present.
1717
# Instead, font-icon-tick is a CSS class on the "Saved" button, and font-icon-save is on the "Save" button
18-
Then I should see the "button.font-icon-tick" element
19-
Then I should not see the "button.font-icon-save" element
18+
Then I should see the "button .font-icon-tick" element
19+
Then I should not see the "button .font-icon-save" element
2020
# Just opening the block doesn't get seen as a "change"
2121
When I click on the caret button for block 1
22-
Then I should see the "button.font-icon-tick" element
23-
Then I should not see the "button.font-icon-save" element
22+
Then I should see the "button .font-icon-tick" element
23+
Then I should not see the "button .font-icon-save" element
2424
# Update the title
2525
# For some reason, using the usual 'When I fill in "changed" for "Title" for block 1'
2626
# it fails to recognise the change in CI even though it works locally for some people.
2727
When I focus on the "#Form_ElementForm_1_Title" element
2828
And I type "changed" in the field
2929
# When I fill in "changed" for "Title" for block 1
30-
Then I should not see the "button.font-icon-tick" element
31-
Then I should see the "button.font-icon-save" element
30+
Then I should not see the "button .font-icon-tick" element
31+
Then I should see the "button .font-icon-save" element
3232
# Change it back
3333
When I fill in "" for "Title" for block 1
3434
When I focus on the "#Form_ElementForm_1_Title" element
3535
And I type "My title" in the field
36-
Then I should see the "button.font-icon-tick" element
37-
Then I should not see the "button.font-icon-save" element
36+
Then I should see the "button .font-icon-tick" element
37+
Then I should not see the "button .font-icon-save" element
3838
# Update the HTML content
3939
When I fill in "<p>New sample content</p>" for "Content" for block 1
40-
Then I should not see the "button.font-icon-tick" element
41-
Then I should see the "button.font-icon-save" element
40+
Then I should not see the "button .font-icon-tick" element
41+
Then I should see the "button .font-icon-save" element
4242
# Change it back
4343
When I fill in "<p>My content</p>" for "Content" for block 1
44-
Then I should see the "button.font-icon-tick" element
45-
Then I should not see the "button.font-icon-save" element
44+
Then I should see the "button .font-icon-tick" element
45+
Then I should not see the "button .font-icon-save" element
4646
# Don't click save at the end - there should be no alert because there were no changes
4747

tests/Behat/features/non-page-save-validation.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ Feature: Blocks are validated when saving blocks on a non-page dataobject
3838
# Click "Add element" button
3939
And I click on the "#Form_ItemEditForm_ElementalArea2 .element-editor__toolbar button" element
4040
# Select ElementContent block type
41-
# And I click on the ".font-icon-block-content" element
4241
And I click "Content" in the ".popover-option-set__button-container" element
4342
# Open the inline edit form for the newly added block
4443
And I click on the caret button for block 2

tests/Behat/features/page-save-validation.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Feature: Blocks are validated when page saving blocks
4040
# Click "Add element" button
4141
And I click on the "#Form_EditForm_ElementalArea2 .element-editor__toolbar button" element
4242
# Select ElementContent block type
43-
# And I click on the ".font-icon-block-content" element
4443
And I click "Content" in the ".popover-option-set__button-container" element
4544
# Open the inline edit form for the newly added block
4645
And I click on the caret button for block 2

0 commit comments

Comments
 (0)