diff --git a/app/presenters/hotwire_combobox/component/markup/dialog.rb b/app/presenters/hotwire_combobox/component/markup/dialog.rb index 3a0a901..cba6989 100644 --- a/app/presenters/hotwire_combobox/component/markup/dialog.rb +++ b/app/presenters/hotwire_combobox/component/markup/dialog.rb @@ -5,7 +5,7 @@ def dialog_wrapper_attrs def dialog_attrs customize :dialog, base: { - class: "hw-combobox__dialog #{platform_classes}", role: :dialog, data: { + class: "hw-combobox__dialog", role: :dialog, data: { action: "keydown->hw-combobox#navigate", hw_combobox_target: "dialog" } } end @@ -34,15 +34,6 @@ def dialog_focus_trap_attrs end private - def platform_classes - platform = HotwireCombobox::Platform.new request&.user_agent - - view.token_list \ - "hw-combobox--ios": platform.ios?, - "hw-combobox--android": platform.android?, - "hw-combobox--mobile-webkit": platform.mobile_webkit? - end - def dialog_input_id "#{canonical_id}-hw-dialog-combobox" end diff --git a/app/presenters/hotwire_combobox/component/markup/fieldset.rb b/app/presenters/hotwire_combobox/component/markup/fieldset.rb index c630463..6990ad6 100644 --- a/app/presenters/hotwire_combobox/component/markup/fieldset.rb +++ b/app/presenters/hotwire_combobox/component/markup/fieldset.rb @@ -1,10 +1,19 @@ module HotwireCombobox::Component::Markup::Fieldset def fieldset_attrs customize :fieldset, base: { - class: [ "hw-combobox", { "hw-combobox--multiple": multiselect? } ], data: fieldset_data } + class: [ "hw-combobox", platform_classes, { "hw-combobox--multiple": multiselect? } ], data: fieldset_data } end private + def platform_classes + platform = HotwireCombobox::Platform.new request&.user_agent + + view.token_list \ + "hw-combobox--ios": platform.ios?, + "hw-combobox--android": platform.android?, + "hw-combobox--mobile-webkit": platform.mobile_webkit? + end + def fieldset_data data.merge \ async_id: canonical_id,