Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block caption invisible in some themes #32470

Closed
fullofcaffeine opened this issue Jun 4, 2021 · 5 comments
Closed

Block caption invisible in some themes #32470

fullofcaffeine opened this issue Jun 4, 2021 · 5 comments
Assignees
Labels
[Status] In Progress Tracking issues with work in progress

Comments

@fullofcaffeine
Copy link
Member

fullofcaffeine commented Jun 4, 2021

Description

The caption text element (<figcaption>) has a transparent color set on some themes for some reason, making it invisible.

Step-by-step reproduction instructions

  1. Make sure your WordPress site has the Twenty Fourteen theme set;
  2. Add a Video or Image block, embed a Youtube video for example;
  3. Or add an Image block and upload an image;
  4. Add a caption to the video, or the image. Observe how the text can't be seen. You can still select and type, though.

Expected behaviour

The caption text (<figcaption>) should have a color that contrasts with the background to make it visible to the user, it should not be transparent.

Actual behaviour

The caption text element (<figcaption>) has a transparent color set on some themes (more details below) for some reason, making it invisible.

Screenshots or screen recording (optional)

CaptionIssue1

WordPress information

  • WordPress version: 5.8-alpha-50843.
  • Gutenberg version: 10.7.2.
  • Are all plugins except Gutenberg deactivated? Yes.
  • Are you using a default theme (e.g. Twenty Twenty-One)? No.

Device information

  • Device: Desktop.
  • Operating system: Ubuntu Linux 18.04.
  • Browser: Firefox 90.0b3.
@fullofcaffeine
Copy link
Member Author

fullofcaffeine commented Jun 4, 2021

I've bisected and it seems to have been introduced here: #31870. cc @ellatrix.

@mrfoxtalbot
Copy link

mrfoxtalbot commented Jun 7, 2021

I was able to reproduce this issue with version 10.7.2 of the plugin active. The problem is solved as soon as the plugin is deactivated.

Screen Shot on 2021-06-07 at 06:56:58
Screen Shot on 2021-06-07 at 06:56:05

All bundled themes between Twenty Ten and Twenty Sixteen (both included) are affected by this bug.

Screen Shot on 2021-06-07 at 07:02:30

Screen Shot on 2021-06-07 at 06:58:09
Screen Shot on 2021-06-07 at 06:59:40
Screen Shot on 2021-06-07 at 07:00:08

@ellatrix
Copy link
Member

ellatrix commented Jun 7, 2021

I don't see how #31870 could have caused this.

The rule making it white is:

.is-dark-theme .wp-block-image figcaption {
    color: rgba(255, 255, 255, 0.65);
}

Which is set by:

@mixin caption-style-theme() {
color: #555;
font-size: $default-font-size;
text-align: center;
.is-dark-theme & {
color: $light-gray-placeholder;
}
}

The theme is detected to be dark. Was the editor background previously dark? As far as I can see the theme is not setting a dark background.
Or is the light/dark detection wrong?
And has the rule perhaps a too high specificity?

Cc @jasmussen

@jasmussen
Copy link
Contributor

Not too long ago, a WordPress theme explicitly had to declare that it was "a dark theme", which would then result in the is-dark-theme body class, leveraged here. But recently that opt-in was automated, with a script that detects the background color. It's possible that script is now comparing colors against a missing element or something to that effect, detecting darkness where it shouldn't. @scruffian do you recall some context on this?

@ellatrix
Copy link
Member

ellatrix commented Jun 7, 2021

I think I see the problem. I'll make a PR.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants