Opened 4 years ago
Last modified 3 years ago
#48691 assigned defect (bug)
Twenty Twenty: Audio block alignment issue
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 5.3 |
Component: | Bundled Theme | Keywords: | needs-patch has-screenshots needs-refresh |
Focuses: | ui, css | Cc: |
Attachments (3)
Change History (19)
#3
in reply to:
↑ 1
@
4 years ago
Replying to nielslange:
You're welcome!
Steps to reproduce:
- Insert an audio block and set a caption
- Enable "Align Center"
Expected behaviour:
Audio block along with its caption should be center aligned when vieweing the actual post.
Current behaviour:
It's already centered in block editor. But it isn't when vieweing the actual post page.
When I chose "Align Right", the audio block goes too far right and overlaps the main content's container. It's resulting horizontal window scroll bar at the bottom appears. See the below screencast:
Expected behaviour for this:
- Audio block should not overlapping main content's container
- Align right the caption
Let me know if there's anything else I should explain more.
Best,
Kharis
@
4 years ago
Alignment issue when "Align Right" enabled on Audio Block. Here is how web browser's inspector shows.
#4
follow-up:
↓ 6
@
4 years ago
- Keywords reporter-feedback removed
- Owner set to nielslange
- Status changed from new to assigned
@kharisblank That's a fantastic issue report! Very detailed and very well done. Do you like to create a patch for this issue?
#6
in reply to:
↑ 4
@
4 years ago
Replying to nielslange:
Do you like to create a patch for this issue?
I will try to make a patch for this and will submit it soon.
Regards,
Kharis
#7
@
4 years ago
You may want to use these test posts to check this patch in action:
- https://qmaubeli.online/patch-test-audio-center-align/
- https://qmaubeli.online/patch-test-audio-left-align/
- https://qmaubeli.online/patch-test-audio-right-align/
Best,
Kharis
#8
@
4 years ago
Hi
I am able to reproduce the problem.
I actually think the centering of the text needs be fixed in the block editor styles and not in the themes.
For example, the block editor styles the figcaption for the video block:
.wp-block-video.aligncenter{text-align:center}
but this is missing for the audio block.
Looking at Twenty Nineteen, the theme itself always centers the figcaption for the audio block, no matter
what the alignment of the block is.
I believe that the min-width part of the patch needs to be removed, because the player is much wider in the editor than it is in the front, what do you think?
#9
@
4 years ago
@kharisblank Thanks for creating the patch. I'd agree with @poena that the styles to fix this issue should be applied to /assets/css/editor-style-block.css
rather than to style.css
.
I also believe that the width of the audio elements should only be changed when needed, but not by default. While I can see the progress bar of the audio track on https://qmaubeli.online/patch-test-audio-center-align/, when viewing the audio block on https://qmaubeli.online/patch-test-audio-left-align/ and https://qmaubeli.online/patch-test-audio-right-align/ the progress bar turns into a single dot which makes it impossible to navigate within the audio file.
#10
@
4 years ago
Hi all,
I'd agree with @poena as well. .aligncenter
is universal class name. A theme should not redefine center alignmet for it.
@nielslange this is what happens without this code.
.wp-block-audio.alignleft audio, .wp-block-audio.alignright audio { width: auto; min-width: 100%; max-width: 100%; }
Best,
Kharis
#12
@
4 years ago
@poena
I believe that the min-width part of the patch needs to be removed, because the player is much wider in the editor than it is in the front, what do you think?
I am not quite sure about this. Because minimum width is defined in below lines of code in block library CSS of the core.
.wp-block-audio audio { width: 100%; min-width: 300px; }
However this breaking right alignment on Twenty Twenty. Without extra custom width min-width: 100%;
, this is what I am getting.
@nielslange
Can you think of another solution?
Let me try it.
Best,
Kharis
#13
@
4 years ago
I used this improved code (only for right alignment at this time). In this code I attempted to maintain the HTML5 audio minimum width to avoid unaccessible audio controls and make it to be more adaptive to its container. By default its width is 270px on Firefox and 300px on Chrome. Refer to W3S.
.entry-content > .wp-block-audio.alignright { max-width: 100%; } @media only screen and (min-width: 480px) { .entry-content > .wp-block-audio.alignright { min-width: 0; padding-right: 2rem; } } @media only screen and (min-width: 1000px) { .entry-content > .wp-block-audio.alignright { position: static; margin-right: 0; left: auto; max-width: 100%; } } @media only screen and (min-width: 1280px) { .entry-content > .wp-block-audio.alignright { max-width: unset; left: auto; } }
This is what I am getting (on Firefox). I tested with Chrome as well and it behaves the same way.
I believe this code still need some testings at your end. I'd like to hear your thought on this.
Extra question:
Does anybody know why lesser width of the audio always appears like this on Safari, even when my custom code removed?
@kharisblank Thanks for reporting this issue. Could you provide more information regarding this issue? The following template might be helpful.
Steps to reproduce:
Expected behaviour:
Current behaviour: