-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added support for Alt+Down Arrow
and Alt+Up Arrow
in ComboBox
#14892
feat: added support for Alt+Down Arrow
and Alt+Up Arrow
in ComboBox
#14892
Conversation
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -600,6 +600,19 @@ const ComboBox = forwardRef( | |||
event.target.value.length | |||
); | |||
} | |||
|
|||
if (event.altKey && event.key == 'ArrowDown') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(match(event, keys.Alt) && match(event,keys.ArrowDown))
{
////
}
this doesn't seem to be working ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no definition for keys.Alt
in packages/react/src/internal/keyboard/keys.js
. Could you add it and retry using match()
again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(match(event, keys.Alt) && match(event,keys.ArrowDown)) { //// }
this doesn't seem to be working ??
I had tried this after adding definition for Alt key
However, if I put any one condition it works as expected but both simultaneously are not working :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting this change! Could you additionally add tests covering this functionality to prevent future regressions?
} | ||
} | ||
if (event.altKey && event.key == 'ArrowUp') { | ||
event.preventDownshiftDefault = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this prevent exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It prevents the default behavior of ArrowUp
button, usually default behaviour of ArrowUp
is not shown when both button are pressed carefully but some time I have detected this behavior (bottom-most index is highlighted)
@tay1orjones I have added tests, this PR is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for making the changes and adding tests!
128836e
…ox (carbon-design-system#14892) * feat: added support * feat: added test * fix: tests
Closes #7998