diff options
-rw-r--r-- | app/helpers/icons_helper.rb | 5 | ||||
-rw-r--r-- | changelogs/unreleased/add-aria-to-icon.yml | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index ab3ef454e1c..ef260cff182 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -7,6 +7,11 @@ module IconsHelper # font-awesome-rails gem, but should we ever use a different icon pack in the # future we won't have to change hundreds of method calls. def icon(names, options = {}) + if !options['aria-hidden'] and !options['aria-label'] + # Add `aria-hidden` if there are no aria's set + options['aria-hidden'] = true + end + options.include?(:base) ? fa_stacked_icon(names, options) : fa_icon(names, options) end diff --git a/changelogs/unreleased/add-aria-to-icon.yml b/changelogs/unreleased/add-aria-to-icon.yml new file mode 100644 index 00000000000..b1449bf16a6 --- /dev/null +++ b/changelogs/unreleased/add-aria-to-icon.yml @@ -0,0 +1,4 @@ +--- +title: Update icon() to automatically include aria-hidden if aria is not found +merge_request: +author: |