Make WordPress Core

Opened 5 weeks ago

Closed 5 days ago

#65177 closed defect (bug) (fixed)

Adminbar: Unnatural focus outline in frontend

Reported by: wildworks's profile wildworks Owned by: wildworks's profile wildworks
Milestone: 7.1 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

The admin bar menu items are expected to change color when focused. However, on the front end, the browser's default outline is also displayed along with the color change.

To ensure consistency between the frontend and the dashboard, I believe this outline should be removed. This issue does not occur on the dashboard because it has styles that reset the outline.

https://github.com/WordPress/wordpress-develop/blob/3b11171716f83efa10787a24ef8a9dae53463a61/src/wp-admin/css/common.css#L270

Attachments (1)

admin-bar-focus-outline.png (65.5 KB) - added by wildworks 5 weeks ago.
Differences in focus styles between front-end and back-end

Download all attachments as: .zip

Change History (8)

@wildworks
5 weeks ago

Differences in focus styles between front-end and back-end

#1 @joedolson
5 weeks ago

Are you sure you're not getting a style leak from the theme? It's common for theme styles to apply to the admin bar.

#2 @hbhalodia
5 weeks ago

Hi @joedolson, I can confirm the issue shared by @wildworks exists. I can see the styles are being applied and there is no any style leak from theme. The outline style attached to the frontend admin bar is coming from the browser default outline style.

I have worked on it and added the style to remove the outline from here src/wp-includes/css/admin-bar.css particularly targeting the admin bar.

Let me know the fix added is in correct file or it should be moved somewhere else, I would be happy to update the PR as per feedback.

Thanks,

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


5 weeks ago
#3

  • Keywords has-patch added

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

## Description

  • Admin bar on wp-admin page was having outline set as 0, but on frontend the default outline was being shown which was having inconsistency with admin page admin bar.
  • PR aims to remove the outline from the frontend admin bar, which mimics exactly the admin bar on wp-admin side.

## Screenshots

BeforeAfter
https://github.com/user-attachments/assets/d5932fa8-900f-4735-a52d-a151d4e5b1db https://github.com/user-attachments/assets/00b43ac0-851e-4fdb-b652-dd1ee193c3fd

## Use of AI Tools

  • None

@hbhalodia commented on PR #11727:


5 weeks ago
#4

Hi @t-hamano, Thanks for the information. I was able to visualize the high constrast mode behavior using dev tools as suggested. Below are the details after applying the fix,

## High Contrast Mode

https://github.com/user-attachments/assets/9fc0e699-c77e-49e1-9035-ae130d06520a

## No High Contrast Mode

https://github.com/user-attachments/assets/dcfc4354-d3cd-47e4-b82c-490610ee5511

Both shows the intended results, with and without contrast. Making outline transparent naturally and highlighting the options in high contrast using outline.

Thanks,

#5 @wildworks
5 weeks ago

  • Milestone changed from Awaiting Review to 7.1

#6 @wildworks
5 days ago

The outline style attached to the frontend admin bar is coming from the browser default outline style.

That's right. This issue needs to be fixed at the core.

#7 @wildworks
5 days ago

  • Owner set to wildworks
  • Resolution set to fixed
  • Status changed from new to closed

In 62459:

Toolbar: Fix unnatural focus outline on frontend.

Make the focus outline transparent to avoid showing an unnatural focus outline on the front end. In Windows high contrast mode, the focus outline is still displayed as before.

Props hbhalodia, joedolson, wildworks.
Fixes #65177.

Note: See TracTickets for help on using tickets.