Skip to content
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

Merged
merged 9 commits into from
Nov 27, 2023
Merged

feat: added support for Alt+Down Arrow and Alt+Up Arrow in ComboBox #14892

merged 9 commits into from
Nov 27, 2023

Conversation

k-rajat19
Copy link
Contributor

Closes #7998

@k-rajat19 k-rajat19 requested a review from a team as a code owner October 12, 2023 19:55
@netlify
Copy link

netlify bot commented Oct 12, 2023

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 11e0107
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/653177e2635c770009f361f8
😎 Deploy Preview https://deploy-preview-14892--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Oct 12, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 11e0107
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/653177e2b8076f0007d0a530
😎 Deploy Preview https://deploy-preview-14892--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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') {
Copy link
Contributor Author

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 ??

Copy link
Member

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?

Copy link
Contributor Author

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 :(

Copy link
Member

@tay1orjones tay1orjones left a 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;
Copy link
Member

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?

Copy link
Contributor Author

@k-rajat19 k-rajat19 Oct 13, 2023

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)

@k-rajat19 k-rajat19 requested a review from tay1orjones October 18, 2023 17:04
@k-rajat19
Copy link
Contributor Author

@tay1orjones I have added tests, this PR is ready for review

Copy link
Contributor

@andreancardona andreancardona left a 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!

@github-actions github-actions bot added this pull request to the merge queue Nov 17, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 17, 2023
@tay1orjones tay1orjones added this pull request to the merge queue Nov 27, 2023
Merged via the queue into carbon-design-system:main with commit 128836e Nov 27, 2023
18 checks passed
danoro96 pushed a commit to danoro96/carbon that referenced this pull request Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request]: Support Alt+Down Arrow and Alt+Up Arrow in ComboBox
5 participants