Make WordPress Core

Opened 10 years ago

Closed 6 years ago

#31396 closed feature request (maybelater)

linked image does not take on the class of the inner image and its justification

Reported by: shamai's profile shamai Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: Cc:

Description

if you put an image in the wordpress editor and press justify left
the image is justified left with a class of "alignleft"

However if you now link the image the outer anchor DOES NOT get the class alignleft. and the image won't align left unless the anchor is set to inline.
what if its not?

For stylistic purposes this is bad. The anchor should float left NOT the image. Otherwise the anchor collapses and is not easily styllable.

there are some stuff you can't do to an image like add pseudo elements. and if the anchor doesn't have the "align left" its annoying and difficult to work with.

the link should get the alignleft class. It creates more flexibility for us theme developers.

Change History (6)

#1 @iseulde
10 years ago

  • Version 4.1.1 deleted

I think I agree, but I'm not sure if we can do this in a backward compatible way. Currently themes would expect to find the class on the image.

#2 @shamai
10 years ago

so put the class on both. or some sort of class on the link so we can handle it easily.

a.alignleft img.alignleft{ float: none; }

#3 @afercia
10 years ago

  • Focuses accessibility removed

#4 @azaozz
6 years ago

The align* classes are not added to the <a> element in the image block either. If this is still needed, better to open an issue on GH: https://github.com/WordPress/gutenberg.

#5 @azaozz
6 years ago

  • Component changed from TinyMCE to Editor
  • Milestone set to Future Release
  • Type changed from defect (bug) to feature request

Moving to the "Editor" component for consideration in the block editor. Hot sure how it would work on the front-end when having several nested elements with aligh* classes, but worth exploring.

#6 @pento
6 years ago

  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from new to closed

As @iseulde mentioned, I don't think this can be changed in either the classic editor, or the block editor, in a backward compatible way.

If you're interested in exploring how it could be done, I'd encourage you to open an issue or pull request over on the Gutenberg repository, to see if it's possible.

Note: See TracTickets for help on using tickets.