Make WordPress Core

Opened 12 months ago

Last modified 5 months ago

#59924 new defect (bug)

Twenty Nineteen: The navigation block submenu button is unreadable

Reported by: poena's profile poena Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: changes-requested
Focuses: css Cc:

Description

The navigation block has an option called "Open on click" that is available when there is a submenu.
When the option is enabled, the parent menu item is a <button> element.
On the front of the website, this button inherits the background styles from the themes button CSS:

button:hover, button:hover, input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover {
	background: #111;
	cursor: pointer;
}

So when the themes default colors are used and someone hovers over the button, the background and text has the same colors, and the text is not readable.

Testing instructions:

Activate Twenty Nineteen
Make sure that your WordPress installation has some content that you can place in the navigation block, because you will need to create a submenu.

Create a new post or page.
Add a navigation block. In the block, select the inserter and add a link: this will be your parent menu item. Click on the link and select the option "Add submenu". Add a link.

Save.
Go to the front of the website.
Locate the navigation and hover over the link item that has the submenu.
Confirm that both the text and the background are dark grey, close to black.

Change History (12)

#1 @sabernhardt
12 months ago

#59925 was marked as a duplicate.

This ticket was mentioned in PR #5703 on WordPress/wordpress-develop by TalhaQuddoos.


12 months ago
#2

  • Keywords has-patch added; needs-patch removed

In src/wp-content/themes/twentynineteen/style.css, I added the following lines in the end:

.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle:hover,
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle:hover+.wp-block-navigation__submenu-icon,
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle:focus,
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle:focus+.wp-block-navigation__submenu-icon
{
  color: #fff;
}

Trac ticket: https://core.trac.wordpress.org/ticket/59924

#4 @talhaquddoos
12 months ago

  • Keywords has-patch added; needs-patch removed

This ticket was mentioned in PR #5704 on WordPress/wordpress-develop by @sabernhardt.


12 months ago
#5

This keeps the background color transparent when hovering or focusing on the toggle button.

It also removes the padding and resets the focus outline offset and border radius.

Below are images showing the focus outline for both the arrow button and the toggle button that includes the text.

https://i0.wp.com/github.com/WordPress/wordpress-develop/assets/17100257/1f0110f2-3b57-4165-8f98-4947f187e28d

https://i0.wp.com/github.com/WordPress/wordpress-develop/assets/17100257/4a2b0ba5-09be-4e7e-ab86-a26e817fa1aa

https://i0.wp.com/github.com/WordPress/wordpress-develop/assets/17100257/1ba750fe-8338-4ba9-b5be-5386a6f41983

https://i0.wp.com/github.com/WordPress/wordpress-develop/assets/17100257/4ea65887-169e-41b2-8529-c80f141e2a36

Trac 59924

#6 @sabernhardt
12 months ago

  • Focuses css added

If changing the text color is better than making the background consistently transparent, that patch would need to edit styles in SCSS files and compile to style.css and style-rtl.css.

However, I think these buttons should adjust padding and the outline offset, so I made another option.

#7 @mukesh27
12 months ago

Thanks @sabernhardt for the PR. Left one minor feedback for consideration.

#8 @poena
9 months ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 6.5

I have tested the PR and it works well, it solves the issue.
-I think the padding can stay as it is in the PR without change.

I also applied the style change in the theme on top of 6.5-alpha-5737 and re-built the CSS files, and the styling is correct there as well.

#9 @poena
9 months ago

It is perhaps a bit of a strange look that the links are underlined, but the button has no bottom border, but I'm fine with fixing the part that is breaking.

#10 @sabernhardt
9 months ago

  • Keywords changes-requested added; needs-testing removed

The modal open and close buttons have the same color issue on screens narrower than 600 pixels.

#11 @poena
9 months ago

  • Milestone changed from 6.5 to Future Release

#12 @karmatosed
5 months ago

  • Keywords has-patch removed
Note: See TracTickets for help on using tickets.