gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Skip link in wrong position with RTL language

Open Sandstromer opened this issue 5 years ago • 5 comments

Description

When using a RTL language, the skip link button/link is positioned at the top left of the browser window.

Step-by-step reproduction instructions

With a FSE theme active or a classic theme without its own skip link function. Change site language to a RTL language. View front-end and tab to bring up the skip link.

Expected behaviour

The skip link should be positioned at the top right.

Actual behaviour

The skip link is positioned at the top left, in the same position as a non-RTL language.

Screenshots or screen recording (optional)

Code snippet (optional)

WordPress information

  • WordPress version: 5.7.1
  • Gutenberg version: 10.5.2
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? TT1-Blocks

Device information

  • Device: Desktop
  • Operating system: Windows 10
  • Browser: Chrome & Firefox

Sandstromer avatar Apr 30 '21 11:04 Sandstromer

@Sandstromer thanks for reporting this! Are you able to share a screenshot or an example of a block theme to test this with?

annezazu avatar May 06 '21 22:05 annezazu

Theme: TT1-Blocks

LTR

gutenberg-skip-link

RTL

gutenberg-skip-link-rtl

.skip-link.screen-reader-text:focus has absolute positioning of 5px from the left.

It looks like we are just missing the rtl styling to position the skip-link to the right.

Sandstromer avatar May 07 '21 10:05 Sandstromer

Ah ha! Thank you so much. I'll update the labels appropriately.

annezazu avatar May 07 '21 16:05 annezazu

This issue seems to have been fixed

Image

I’ve noticed a new issue related to this: the "Skip to Content" button appears to be broken on non-admin pages, as shown in the screenshot below. In RTL languages, the "Skip to Content" button is taking up the entire width of the screen. This issue seems to be caused by

.skip-link.screen-reader-text:focus {
        // other CSS
	left: 5px;
        // other CSS
}';

RTL Image

LTR

Image

I'll raise a PR to fix this :)

im3dabasia avatar Dec 24 '24 15:12 im3dabasia

Thanks for the report! The block-theme skip link is now handled by WordPress core, which ships a dedicated RTL stylesheet (wp-block-template-skip-link-rtl.css) that positions the focused link at the top right (right: 5px). Closing this as fixed. If you still see a positioning problem in RTL on a current WordPress version, please open a Trac ticket, since this code now lives in core.

youknowriad avatar Oct 12 '26 08:10 youknowriad