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

fix submenu focus #662

Closed
wants to merge 5 commits into from
Closed

Conversation

SpaNb4
Copy link

@SpaNb4 SpaNb4 commented Aug 9, 2023

Fixes the following issues:

  1. The focus does not shift back when reopening the menu when a submenu item is active
2023-08-09.14-51-25.mp4
  1. (preact specific) When a sub-menu opens, I can't use the arrow keys to navigate through it
2023-08-09.14-56-16.mp4

Note: I use the antd Dropdown component in the videos above

@yoyo837
Copy link
Member

yoyo837 commented Aug 9, 2023

Please add some test cases to cover this.

@SpaNb4
Copy link
Author

SpaNb4 commented Aug 9, 2023

Please add some test cases to cover this.

I wanted to add some tests, but then I realized that rc-menu doesn't have an autoFocus prop that antd uses. So I'm not sure if it's possible to reproduce this behavior.
And speaking of the second issue, I don't think it's possible to test it, since you need to use preact in your tests

src/SubMenu/index.tsx Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d21b6bb) 99.58% compared to head (2ff8bad) 99.58%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #662   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files          27       27           
  Lines         721      722    +1     
  Branches      196      196           
=======================================
+ Hits          718      719    +1     
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yoyo837 yoyo837 requested a review from zombieJ August 10, 2023 01:28
@zombieJ
Copy link
Member

zombieJ commented Aug 14, 2023

cc @MadCcc

@MadCcc
Copy link
Member

MadCcc commented Aug 14, 2023

Is this issue related?
ant-design/ant-design#43267

import { warnItemProp } from '../utils/warnUtil';
import InlineSubMenuList from './InlineSubMenuList';
import PopupTrigger from './PopupTrigger';
import SubMenuList from './SubMenuList';

export interface SubMenuProps
extends Omit<SubMenuType, 'key' | 'children' | 'label'> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change on this file should be reverted since nothing except order changed.

@MadCcc
Copy link
Member

MadCcc commented Aug 14, 2023

I wanted to add some tests, but then I realized that rc-menu doesn't have an autoFocus prop that antd uses. So I'm not sure if it's possible to reproduce this behavior.

Test for the first problem should be provided, you can trigger focus manually in test case to mock the scene.

@SpaNb4
Copy link
Author

SpaNb4 commented Aug 14, 2023

Is this issue related? ant-design/ant-design#43267

No, this PR is not relevant to the above issue

@SpaNb4
Copy link
Author

SpaNb4 commented Aug 14, 2023

I wanted to add some tests, but then I realized that rc-menu doesn't have an autoFocus prop that antd uses. So I'm not sure if it's possible to reproduce this behavior.

Test for the first problem should be provided, you can trigger focus manually in test case to mock the scene.

Ok, I'll try

@yoyo837
Copy link
Member

yoyo837 commented Dec 6, 2023

Now it conflicts.

@SpaNb4 SpaNb4 marked this pull request as draft December 27, 2023 12:16
@SpaNb4
Copy link
Author

SpaNb4 commented Dec 27, 2023

Closing this since I can no longer reproduce the first issue

@SpaNb4 SpaNb4 closed this Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants