WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 2 months ago

#46538 new defect (bug)

Aligning gallery results in conflicting classes added

Reported by: janpaulkleijn Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.1
Component: Gallery Keywords: reporter-feedback
Focuses: administration Cc:
PR Number:

Description

When a gallery is created in the Visual editor it's class is set to alignundefined. After it is saved and I view the result it's class has no alignment set. So far so good.

When I close the editing and go back to manage posts list and I reopen the same post to be edited the gallery class is still set to alignundefined. Still good.

When I set the alignment to 'Align left' and save the post, the result is that the gallery class is set to 'alignleft'. Still good.

But here it comes: When I close the editing again and go back to manage posts list and I reopen the same post to be edited the gallery class is now set to 'alignleft alignleft', so twice the same class.

And from there on, one 'alignleft' class will be staying in the class attribute. So if I change the alignment to 'Align center' and save the post, the result will be that the class attribute of the <ul> gallery tag holds the value 'aligncenter alignleft'.

This can cause some layout issues, plugin issues etc, etc.

Change History (2)

#1 @desrosj
4 months ago

  • Focuses ui javascript removed
  • Keywords reporter-feedback added; needs-patch removed

Hi @janpaulkleijn,

Can you provide some more details? Are you using the Classic Editor? Or the block editor? I was unable to get galleries to align at all in the Classic Editor, and I was unable to reproduce the issue using the block editor.

Are you still seeing the issue? Are you able to reproduce the issue with the latest version of WordPress with no plugins active and a default theme?

#2 @janpaulkleijn
2 months ago

Hi,
I used the gutenberg editor. I don't know if it is already corrected. I think so.

Note: See TracTickets for help on using tickets.