Skip to content

Menu: Wrap menu items in a <div> #1342

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

Merged
merged 3 commits into from
Oct 30, 2014
Merged

Conversation

tjvantoll
Copy link
Member

Fixes #10162

@tjvantoll tjvantoll force-pushed the menu-wrapping branch 2 times, most recently from 07496a3 to cd9f65e Compare September 28, 2014 01:22
tjvantoll added a commit to tjvantoll/jquery-ui that referenced this pull request Sep 28, 2014
This avoids styling issues where ui-state-focus rules apply to submenus.

Fixes #10162
Closes jquerygh-1342
tjvantoll added a commit to tjvantoll/jquery-ui that referenced this pull request Sep 28, 2014
This avoids styling issues where ui-state-focus rules apply to submenus.

Fixes #10162
Closes jquerygh-1342
@tjvantoll
Copy link
Member Author

This is ready for review now. cc @scottgonzalez @jzaefferer @arschmitz @kborchers and anyone else interested.

May @kborchers one day forgive me for this transgression.

tabIndex: -1,
role: this._itemRole()
});
.find( "> div" )
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to use .find with a child selector here instead of using .children, like everywhere else in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope. Switched.

@jzaefferer
Copy link
Member

Looking at the visual tests for Menu, I noticed our old friend the 1px glitch. This one happens when looking at the "Menu with icons" test. Move the mouse to open the last submenu, then hover the first submenu item. Look at the third second submenu. Move the mouse to the item below the foucsed one. Note the second submenu jumping one pixel down, before the other submenu is displayed. Also happens the other way round, where the lower submenu glitches before it disappears. As usual, its just one 1px, but rather annoying anyway. Also happens for the "Menu with custom markup" test.

On the "Menu with custom markup, multi-line items and a custom submenu icon" test, the submenu has bad styling: The focus state doesn't fill out the container.

Code itself looks fine, apart from the one tiny issue I noted above. And the big glaring issue of sprinkling divs everywhere.

@tjvantoll
Copy link
Member Author

@jzaefferer I fixed the demo issue and made the code change you suggested.

And I'll try to refigure out our favorite glitch issue this weekend.

tabIndex: -1,
role: this._itemRole()
});
.children( "div" )
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there should be a hard-coded element here. Can't this just be .children()?

Copy link
Member Author

Choose a reason for hiding this comment

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

I just did some testing around this and it works fine. Good catch.

@tjvantoll
Copy link
Member Author

I went through and incorporated @scottgonzalez's changes/feedback. At least now you can build <article> and <blockquote> soup to go with your <div> soup.

The 1px dance should be the only action item left, but it continues to mystify me. I'm going to enlist @tcrowley's help.

@tjvantoll
Copy link
Member Author

I've resolved most of the dancing issues, but one related to submenus still remains. You can see it on this fiddle: http://jsfiddle.net/tj_vantoll/8ym9u177/. I'm going to dig back into that tomorrow, but if anyone has an idea what might be going on let me know.

tjvantoll added a commit to tjvantoll/jquery-ui that referenced this pull request Oct 11, 2014
This avoids styling issues where ui-state-focus rules apply to submenus.

Fixes #10162
Closes jquerygh-1342
tjvantoll added a commit to tjvantoll/jquery-ui that referenced this pull request Oct 11, 2014
This avoids styling issues where ui-state-focus rules apply to submenus.

Fixes #10162
Closes jquerygh-1342
@tjvantoll
Copy link
Member Author

I finally resolved the last outstanding issue here and rebased this branch. If anyone else wants to take a look feel free, otherwise this is ready as soon as we're putting 1.12 stuff in master.

@tjvantoll tjvantoll added this to the 1.12 milestone Oct 22, 2014
@@ -24,7 +24,9 @@ TestHelpers.menu = {

click: function( menu, item ) {
lastItem = item;
menu.children( ":eq(" + item + ")" ).trigger( "click" );
menu.children( ":eq(" + item + ")" )
.find( ".ui-menu-item-wrapper" )
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be .children() so that it handles items with submenus properly?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only if you click a menu item that contains a submenu, which none of the existing tests that use this method do. But I'll change this for future proofing.

tjvantoll added a commit to tjvantoll/jquery-ui that referenced this pull request Oct 25, 2014
This avoids styling issues where ui-state-focus rules apply to submenus.

Fixes #10162
Closes jquerygh-1342
@tjvantoll
Copy link
Member Author

Changes made based on @scottgonzalez's comments and I rebased this against master again.

@tjvantoll tjvantoll merged commit e9643f6 into jquery:master Oct 30, 2014
tjvantoll added a commit that referenced this pull request Nov 7, 2014
This avoids styling issues where ui-state-focus rules apply to submenus.

Fixes #10162
Closes gh-1342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants