Skip to content

Commit 1dcd8c9

Browse files
committed
Add keyboard interactions
1 parent 754ae6b commit 1dcd8c9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ruby_ui/carousel/carousel.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ def default_attrs
2222
aria_roledescription: "carousel",
2323
data: {
2424
controller: "ruby-ui--carousel",
25-
ruby_ui__carousel_options_value: default_options.merge(@options).to_json
25+
ruby_ui__carousel_options_value: default_options.merge(@options).to_json,
26+
action: %w[
27+
keydown.right->ruby-ui--carousel#scrollNext:prevent
28+
keydown.left->ruby-ui--carousel#scrollPrev:prevent
29+
]
2630
}
2731
}
2832
end

0 commit comments

Comments
 (0)