From 6fa2c580b421e4233c57078dc3ac67617ccaa6c8 Mon Sep 17 00:00:00 2001 From: Sean Aery Date: Thu, 19 Dec 2024 10:56:36 -0500 Subject: [PATCH] Fix skip link display during keyboard navigation. Fixes TD-1412. - subclass the BL core SkipLinkComponent and configure trln_argon to use ours - note legacy BS4 .sr-only is problematic due to css in font-awesome-rails gem - refactors fix from #448 so it uses a subclassed component --- .../skip_link_component.html.erb | 8 ++++---- app/components/trln_argon/skip_link_component.rb | 6 ++++++ lib/trln_argon/controller_override.rb | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) rename app/components/{blacklight => trln_argon}/skip_link_component.html.erb (64%) create mode 100644 app/components/trln_argon/skip_link_component.rb diff --git a/app/components/blacklight/skip_link_component.html.erb b/app/components/trln_argon/skip_link_component.html.erb similarity index 64% rename from app/components/blacklight/skip_link_component.html.erb rename to app/components/trln_argon/skip_link_component.html.erb index fd07c8fe..760b00b3 100644 --- a/app/components/blacklight/skip_link_component.html.erb +++ b/app/components/trln_argon/skip_link_component.html.erb @@ -1,9 +1,9 @@ -<%# TRLN override. Remove Bootstrap 4 sr-only classes. This override can be removed with the next release of Blacklight, as -as they've been removed on the main branch. %> +<%# TRLN override. Remove Bootstrap 4 sr-only classes. This override can be removed in BL9 -%> +<%# https://github.com/projectblacklight/blacklight/blob/release-8.x/app/components/blacklight/skip_link_component.html.erb -%> \ No newline at end of file + diff --git a/app/components/trln_argon/skip_link_component.rb b/app/components/trln_argon/skip_link_component.rb new file mode 100644 index 00000000..abe7a2c3 --- /dev/null +++ b/app/components/trln_argon/skip_link_component.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +module TrlnArgon + class SkipLinkComponent < Blacklight::SkipLinkComponent + end +end diff --git a/lib/trln_argon/controller_override.rb b/lib/trln_argon/controller_override.rb index 913e3d42..17c649db 100644 --- a/lib/trln_argon/controller_override.rb +++ b/lib/trln_argon/controller_override.rb @@ -36,6 +36,9 @@ module ControllerOverride # https://github.com/projectblacklight/blacklight/issues/3154 config.search_state_fields << %i[id debug doc_ids] + # TRLN custom skip link display. + config.skip_link_component = TrlnArgon::SkipLinkComponent + # Sets the sidebar component for the index view in the TrlnArgon configuration. config.index.sidebar_component = TrlnArgon::Search::SidebarComponent config.index.document_component = TrlnArgon::DocumentComponent