Problem/Motivation
"Unpublished" style of rendered entities is not accessible (pink too hard to notice for some) (and looks bad)
blocks #2290101: UI telling you a field is shared across languages is way too subtle
Bug because there is an accessibility violation. Even for sighted people with good vision, the light pink background is difficult to see. For someone with low vision, there is no distinction. For someone using a mobile device outside, they won't be able to distinguish between published and unpublished content. For a blind user, there is no indication that a node is unpublished.
Major because this is a basic part of Drupal Core's workflow and it isn't accessible. This doesn't meet WCAG 2.0 AA, but also presents usability challenges.
Proposed resolution
Add a marker to nodes & comments to ensure that the published/unpublished state is semantically defined.
Enhance the visual representation of the unpublished content so that it is more distinct.
Remaining tasks
-
Update the patch so the marker is properly output for both nodes and comments that are unpublished in the Bartik, Stark, and Claro themes following the approach taken in patch #275 (https://www.drupal.org/project/drupal/issues/867830#comment-13839909)
Currently, the markers are being output only for unpublished nodes in Bartik articles and comments in Stark. The marker should be output for all unpublished nodes and comments on all frontend themes. That is, all the no's in the table below should become all yes'.
Current status of marker output with patch #275 Theme/Node Node Comment Bartik - Basic Page no no Bartik - Article yes no Stark - Basic Page no yes Stark - Article no yes Claro - Basic Page no no Claro - Article no no Output should include hidden text to give screen reader users context to for the status marker:
<span class="marker marker--warning"> <span class="visually-hidden">This node is</span> Unpublished </span>Note: Current output in the stark theme with patch #275 uses the
<mark>element. This should be changed to the spans with visually hidden context above. The<mark>element was moved to https://www.drupal.org/project/drupal/issues/1311372. - Update patch to get tests passing
- To be discussed: The colors for marker warnings used in the latest patch (#275) do not pass WCAG guidelines for color contrast. (Success marker has ratio of 2.53:1 and warning marker has ratio of 2.46:1. Ratio should be at least 4.5:1.) Maybe this is part of a design already approved elsewhere and is out of scope of this issue? Otherwise, if these colors are being newly introduced with this issue, they should be revised for accessibility.
User interface changes
CSS changes.
before
This example has an unpublished node, with an unpublished comment.

after
Unpublished comments:

Unpublished nodes:
Screenshot needed once it's working in patch.
API changes
None.
Original report by @joshk
I really like this change: #394736: Unpublished node's pink background unclear
As the pink background is just too hard too see. This is the same issue as for unpublished comments as well!
Why this change should be committed during RC
A color based signifier for content state is not accessible or intuitive for any users.
| Comment | File | Size | Author |
|---|---|---|---|
| #308 | Screenshot 2025-07-16 at 19.25.10.png | 126.38 KB | markconroy |
| #304 | 867830-304.patch | 17.5 KB | vsujeetkumar |
| #296 | interdiff_293-296.txt | 1.03 KB | vsujeetkumar |
| #296 | 867830-296.patch | 33.96 KB | vsujeetkumar |
| #293 | interdiff_291-293.txt | 15.7 KB | vsujeetkumar |
Issue fork drupal-867830
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
joshk commentedConfirmed that comment.css is still using that old dusty-pink style. I will roll a patch tonight!
Comment #2
yoroy commentedPlease do :)
Comment #3
joshk commentedOk, got distracted. Here's the patch, plus the before/after screenshots in Bartik, plus working shots from Garland and Stark.
It uses exactly the same technique as the node upublished technique.
Comment #4
yoroy commentedbot?
Comment #5
dries commentedI agree that 'pink' doesn't communicate 'unpublished'.
Comment #6
yoroy commentedIt works even with one-line comments: http://skitch.com/yoroy/dxrb2/test-d7
Comment #7
sun#3: comments-unpublished.patch queued for re-testing.
Comment #8
jacineI'm against this, unless the code is moved to theme(s) or a less intrusive solution can be agreed upon. Here's why:
This will result in unnecessary overrides for template files and CSS for many themes. We have a
.comment-unpublishedclass, and we have easily editable template files, so why can't we just let themes decide how they want to style this?If we must do something here, is there anything less intrusive we can do to communicate this status clearly?
I also do not see this #394736: Unpublished node's pink background unclear as having been committed.
Comment #9
jacineActually, it fails out of the box with 2 sidebars.
Comment #10
Jeff Burnz commentedThe textual message is good because it solves a nasty accessibility issue that there is no non-visual indicator of unpublished content - however themes should set the design for this, not a core module.
Comment #11
mgiffordtagging
Comment #12
mgifford@Jacine - Thanks!
#8-2 with the fonts, the blocks module defines a font-family too modules/block/block.css: font-family: "Lucida Grande", Verdana, sans-serif;
#8-3 I think it would work fine with a black background. It certainly would be more visible than the existing pink background for anything other than the same gray used with the text.. For most backgrounds it would be much more visible than what is there now.
#8-5 I wonder if the font size could be smaller for the comments too. We should have translations for unpublished in many different languages. I wonder if there is a way to simply compile all of the known translations for string length.
#9 this would also be a problem with #394736: Unpublished node's pink background unclear then I assume.
This text is key for visually impaired people to be able to understand the difference between published & unpublished comments:
How do we get that in while encouraging themes to decide how best to style this?
Most of the controversy is around the css, so just focusing on the CSS, what if we nix the font & reduce the size of the text to 4em's:
Comment #13
sunBetter title.
What we will do for D7 is the following:
1) We only add that textual representation of the unpublished status, and only that, and with the usual .element-invisible class applied to it.
2) We move that output into a proper theme function, and we make it generic. I.e., to make this crystal clear: theme_unpublished_marker() [or similar] produces always the same output, regardless of whether for nodes or comments or whatnot, and always has the .element-invisible class (set by the theme function), and optionally an additional, generic "unpublished" class. The template only contains a template variable. The themed output is prepared and generated as usual in the template preprocessor, depending on the respective entity's status.
3) Zero, absolutely none CSS styles go into D7 core for this.
Lastly, since the old issue title somehow suggested that there was or is some existing stuff for nodes already, and if there actually is something, then we are reverting that here to make this consistent.
Comment #14
sunProper category and component.
Comment #15
Jeff Burnz commented1) Why hide this, seems this information is useful to everyone not just screen reader users. For screen readers it needs context, i.e. a heading, dumping the word "Unpublished" in a node or comment may not be useful if its not contextualized.
2) Agree, but, can we get that into D7 - we need to fix but can we do it properly or will we need a hacky solution for D7 (strait in the tpl's)
3) Agree - zero CSS in modue css for this.
Looks like there was no commit for the node template stuff so I marked #394736 as a duplicate in favor of cleaning it all up in one issue.
Comment #16
sunAm I missing something? I thought the whole purpose of this issue was to fix accessibility of unpublished entities (comments), which are currently just colorized...?
The list was meant additive, i.e., we do all of (1) to (3), but we don't change the existing visual behavior/look. We merely and solely fix the accessibility bug.
By introducing a theme function and standardizing its usage in templates, themes are free to override that and do whatever they want, but D7 core will not. D7 core will just fix the accessibility bug.
Comment #17
Jeff Burnz commentedThe original issue was just that pink was not a good indicator of status so the proposal was to add text as well, the problem with the node and comment patches are the styles & for screen readers the "message" would have no context - the screen reader user could learn that hearing the word "unpublished" when viewing node and comments means something important. Its better if we hide a heading above it just for screen reader users.
So the issue as I see it pans out to several things:
1. Color alone is not sufficient indicator of status, and a WCAG violation (for sighted users).
2. A simple message with no context is difficult/problematic for screen reader users.
Comment #18
sunHrm. WCAG violation for sighted users... If you'd ask me (but I'm not familiar with all of this), then I'd say a visual improvement for sighted users can happily wait for D8. The only definite bug I see is that non-sighted users have no effin' clue why a unpublished post still appears, because they don't see that background color at all. So, if it was me, I'd limit this bugfix for D7 to the hard accessibility bug for non-sighted users, especially as there is no valid and working solution for a visible "unpublished" text yet, so I'd leave that visible part to contrib for now (which can be easily done, given the theme function we're about to implement here).
However, that's just me, and so we need to ask Dries/webchick for their perspective. Until they follow-up, we can and should already work on the first part.
Comment #19
Everett Zufelt commentedBeing a screen-reader user I know if a node or comment is unpublished (unapproved) because I have an option to approve / publish. Would anyone without the ability to publish / approve see an unpublished / unapproved entity?
As for colour, as long as it is perceivable, it is the same WTF for everyone about what the colour means, and again, can they not see the ability to pub / approve?
Comment #20
jacineThis is wrong. It should never happen. It's unfortunate and disappointing that these styles keep making it into core CSS files. block.css is an atrocity, but unfortunately it's D8 material: #865084: Clean up block module css styles.
I don't want to see any background color, color, or font-size changes. Every single piece of code that messes with CSS in this way, ends up as another inconsistency and annoyance for a theme developer writing a custom theme. It's up to each theme to decide how this should fit into their design.
I'm not just objecting to the CSS though. I don't like how this is placed in the template file. I find it over designed for core, intrusive and IMO it's misplaced as it really only makes sense for this specific of design. If this text is properly placed, there will be no need to provide CSS for it. I'd much prefer a variable in the templates containing something like:
<span class="status">This [entity] is [status].</span>or something, right underneath the title. I also agree that it should be generated by a theme function as opposed to spreading similar code across multiple template files, as there are more than a few places where this makes sense.Yes.
Bottom line is that it's not just an WCAG issue. I think it's clearly D8 material, but if for whatever reason an exception is made, it should be done right.
Comment #21
bowersox commentedsub
Comment #22
mgifford#3: comments-unpublished.patch queued for re-testing.
Comment #23
mgiffordLooks like the best we can do here is the suggestion from @sun in #13 for D7.
With that we can add the css in a theme or the accessibility helper module easily enough.
Can someone roll up a patch so we can try to get this into core?
No CSS, just the invisible text
Comment #24
mgiffordalso, this post has been favoured from #394736: Unpublished node's pink background unclear which is now marked as a duplicate.
All the text from from http://drupal.org/files/issues/node-unpublished-394736.patch will need to be brought over and marked with element-invisible's class.
Not hard, but...
Comment #25
mgiffordOk, this improves things for screen readers at the very least. Hopefully this can get into core & address unpublished nodes & comments.
I don't think there are any i18n considerations as the terms are very generic and must be used elsewhere.
Comment #26
Everett Zufelt commentedStill waiting on an answer to #19. The best method for solving this issue would seem to require us to:
1. Assess where we are.
2. Decide where we want to be.
3. Determine the best path between 1 and 2.
:)
Comment #27
Jeff Burnz commentedIts very hard to assess where we are Everett, your reports while interesting do not reflect a wider community. You are making an inference that a node or comment has a particular status, but its not stated, I think that is quite brittle, to rely of the appearance and detection of a link - in your own words you demand additional cognitive cycles - you make me think about this, rather than it simply being stated as such - this node is unpublished.
Was there some earth shattering reason why we can't have
<?php print $unpublished; ?>, & push the logic back to template_preprocess_node etc, its not an API change, technically its an addition. Our templates are already clogged to the brim with confusing crap, really rather not have to do that in tpl.Comment #28
Everett Zufelt commented@Jeff
I am really not being argumentative here. I am attempting to gather information, about something that I am admittedly ignorant about, so that I can participate in a discussion about the best solution to the problem.
Comment #29
mgifford@Everett - I Angie's point with the cat is better, but I've tried to lay out as much detail as I can here:
#928776-20: Unpublished comments have a styling issue
Please either apply the patch or check out my sandbox. Sorry you need to request another account.
@Jeff -
<?php print $unpublished; ?>sounds good to me. Do you have time to roll up another patch. If not I can try to review it tomorrow.Comment #30
Everett Zufelt commentedAfter getting some more information about this problem let me summarize my thoughts.
Problem
Entities do not explicitly display their status textually. Nodes only implicitly display their status textually if the node is in Edit mode.
Severity
Not critical since this existed in D6, but certainly important as this would improve usability and accessibility.
Solution
I like @Sun's suggestion in #13, with the exception of thinking that the textual representation should be visible to all by default, I am however flexible on this as long as it is easy for a themer to override the visibility of the text. Sun's approach is in accordance with good clean markup and easy to understand template files.
Challenges
#13 would mean that an API change needs to occur (perhaps this is only an API addition, I am not familiar enough to know for sure). Would #13 be able to go into D7, or would it have to wait for D8? Can we get Dries / Webchick's input on this possible solution without a patch to review, or would we need to roll a patch for #13 to get a review?
I would like to see a solution to this problem in D7, but if there is no clean solution that we can get into D7 I would be content with waiting to fix this problem once, and properly, in D8.
Comment #31
jacineThank you Everett. I'm happy to see an accurate assessment of the problem and acknowledgement of feedback that @sun and I gave in previous comments. As I mentioned, I'm on board with the solution as described in #13. I think the text should be visible though, or we are not solving anything here, other than making the text available to screen reader users. The reason this issue was opened in the first place is that the pink background is not a sufficient indication for an unpublished status and I think we all agree on that.
The patch in #25 does not take into account that this should be in a theme function, nor is it even consistent across the template files. Just moving the "crap" to preprocess functions it not acceptable either. Littering in preprocess functions is almost as bad files. This sort of thing is the definition of a use case for a theme function, so anything else is just a hack.
As Jeff points out in #27 it should just be printed as
<?php print $unpublished; ?>in templates. No logic. This variable should generated in preprocess functions and print the status or and empty string. Also, is it really necessary to add all this markup?I don't think so...
Come to think of it, we already have a theme function theme_mark(), which exists for this sole purpose and is already styled (colored red) by default. I don't understand why we are not using it in more places, like in the comment.tpl.php file to indicate a new comment. It would be a good fit for the core solution IMO. Sure, it needs to be improved, and it's probably out of scope for D8, but so are a lot of other, equally important issues.
It's very important that we do not undo the work that was done to improve consistency and to clean up template files. I'd also like to point out that themes have access to the status of each of these entities and can easily implement a solution, in case that's not clear. We should not just throw markup at template files and call it a fix or an improvement, as tempting as it may be and especially, not at this stage. If we are going to fix this, we need to do it right, or do it in Drupal 8.
Comment #32
Jeff Burnz commentedOK, how about we pursue the theme_mark idea and go for a maintainer review to see where we're at for D7, I too would live with it being shunted to D8 for a proper fix.
Comment #33
mgifford@Jacine I don't know if the the H2 line is added.
It would be really nice if we could get the output of #25 into core. Even if it only improves the situation for screen readers, it doesn't add to translation issues. I've worked on bringing this into the templates so it has less impact for themers by adding this to the template.php file in Bartik:
and the line Jeff suggested to the comment.tpl.php & node.tpl.php files:
I'm missing something for the comments though so that it isn't working.
I'd like to get this set up in a way that is visible, but @sun's said no additional css on this issue & there may be concerns about design changes.
It could be that we have to wait for D8 for this, but if we bring it in for screen readers there will be a precedent for D8 so that this can be addressed better for everyone.
Comment #34
Jeff Burnz commentedI'm a little perplexed why we want to hide this - that seems like a design decision best left to the themer.
Comment #35
mgiffordThe only reason to make the text invisible as far as I am concerned is to make it possible to get into D7. Otherwise I'm all for going the route that Zen has or some similar way to theme it up.
If we can get a design decision in for D7 I'd be very happy!
Comment #36
cliffTreading here gently, because I read through the issue queue quickly and am still a little foggy in the head from some dental work this afternoon. But:
So it seems to me that we need a patch that creates content — a clear statement of the item's status, just like the models Jacine gave in #20 — and leaves it to the theme in use to style that content appropriately.
Too much for D7, even in a point release? Then let's work it into D8. But that is certainly not my call to make.
Comment #37
jacineComment #38
mgiffordOk, so if we take the core themes and just add add:
to the comment.tpl.php & page.tpl.php files. If the output from that is:
So the output is invisible by default and does not change any of the visual look/feel of the site (and heck for books in publication changing this would be a pain). This would made it possible for screen readers to know that a node/comment is unpublished. It has no significant changes to anyone else that I can see.
All the logic would go into the template.php files. I really think that this should go in core for D7. Even in a point release.
We need to work on this for D8 so that it is visible & properly themable. However, I think we can leave that for D8.
Comment #39
sunIt was already mentioned earlier that the markup contained in the template variable has to be generated by a generic theme function. Using the theme function, site builders and themers can tweak the output in whatever way to their likings. For D7, the default theme output uses .element-invisible.
However, I have the impression that there is some sort of disagreement about the usefulness of this textual status representation? Would be great to see an unbiased summary of the discussion.
Comment #40
bowersox commentedIt seems that we are in general agreement that for D7 we should leave the visual display as-is and add invisible text to improve accessibility. This was first suggested by @sun in #13 and this idea seems to be a consensus. For D8 we can return to the idea of using visual wording in addition to the pink background (or instead of the pink background).
Comment #41
Everett Zufelt commented@Sun
I think that there is agreement on the usefulness of the text, if anyone implied that it was not useful it may have been me. I do think the text is useful, I was trying to assess how severe of a problem there currently is, since I haven't had any problems myself.
As I understand it the following is required.
1. Enhance theme_mark() to allow for new mark types.
2. Possibly enhance theme_mark to provide the ability to pass 'classes' as a key in $variables, this is so that element-invisible can be passed, not to add any new CSS to Core. I prefer the mark not be invisible, but am content either way.
3. Provide a $unpublished variable in preprocess functions (which will get its value from theme_mark).
4. Add
print $unpublished;to entity template files.Other than that this may be (likely is) out of scope for D7, does anyone wish to correct or object to the above?
Comment #42
mgiffordOk, so for the #1, are we looking for something like:
As far as passing CSS through, I suppose one could just extend the array that's passed through by adding:
$class = $variables['class'];
Having the default for new & updated to be marker & the class for unpublished to be element-invisible.
What else can we document before someone wraps up a patch?
Comment #43
sun3 days before RC, this is going to be D8 material.
Comment #44
mgiffordOk, this issue has been cold for a while. How are we going to ensure that we do a better job in Drupal 8? Unpublished content really shouldn't just be a very pale pink. Can we set a better default? I do think Zen set a good example here. Are there others that have been used in D7 themes we should be considering?
Comment #45
bowersox commentedIt seems like Everett's summary in comment #41 is the best summary of a plan for moving ahead.
If anyone objects to that consensus, please speak up.
Comment #46
mgiffordOk, this needs to be cleaned up and tested for the bot, but wanted to put up a more recent patch with /core/ to get us moving with Everett's suggestion above.
Comment #48
mgiffordOops.
Comment #50
mgiffordLooks like this needs some work on the unit testing.
Comment #51
mgiffordRerolled.
With the implementation of a draft state in Drupal 8 this will be even more important to clarify.
Comment #53
mgifford#51: comment-node-unpublished-867830-51.patch queued for re-testing.
Comment #55
mgiffordre-roll with attempt to fix notices.
Comment #56
mgifford#55: comment-node-unpublished-867830-55.patch queued for re-testing.
Comment #57
Oaryx commentedFatal error: Call to undefined function bartik_theme_mark() in /home/s071daa1dd4b1f22/www/core/themes/bartik/template.php on line 82
Failed on simplytest.me when switching to unpublished content.
Comment #58
mgiffordNot sure how I missed this, but I wasn't respecting theme_mark().
This should resolve that error. Thanks for reporting it Oaryx.
Comment #59
Pete B commentedFixed the comment to give the correct constant name
Refactored theme_mark to add a drupal_clean_css_identifier for sanity, and so we don't have so many identical spans
Improved bartik_preprocess_node and bartik_preprocess_comment to use the MARK_UNPUBLISHED constant
Thanks,
Pete
Comment #61
mgifford#59: comments-node-unpublished-867830-59.patch queued for re-testing.
Comment #62
mgiffordI hadn't run into this function before:
http://api.drupal.org/api/drupal/core!includes!common.inc/function/drupa...
Like your re-factoring of theme_mark(). I do hope that the bot was just buggy as it looks good.
Just got this error on creating a new page though:
Fatal error: Call to undefined function bartik_mark() in /home/s1c6ed7f5a1c61ca/www/core/themes/bartik/template.php on line 82Comment #64
Pete B commentedI'm pretty sure that test fail in HistoryTimestampTest can't be related to this. Rerolling to fix the issue #62.
Comment #65
Pete B commentedSetting needs review.
Comment #67
Pete B commentedOh dear, I see the problem here...
Comment #68
mgiffordThis shouldn't be like this:
+ <?php print (isset($unpublished)) ? $unpublished : 'fiwehgewiuf'; ?>I also couldn't see any text associated with the unpublished comment.

Something was lost between #51 & #55.
Comment #69
micnap commentedHere's the same patch with a few corrections.
Comment #70
mgiffordUnpublished is under the Comments. This needs to be changed in CSS.

Comment #71
micnap commented@mgifford - where should unpublished show for each comment?
Comment #72
mgiffordGood question.. I think in this case it might make sense to just float right. It shouldn't overlap other text or lines and should be within the pink.
I added some more usability tags and hope to get some feedback from Bojhan.
Comment #73
Bojhan commentedThis probally needs a bit of design, I dont think we should randomly float this - this is part of Bartik. Can I see all the cases this shows up and I will design how it should intertwine.
Comment #74
mgiffordThanks Bojhan!
Comment #75
mgifford#69: comments-node-unpublished-867830-69.patch queued for re-testing.
Comment #77
mgiffordReroll as the filename changed to bartik.theme
Comment #78
mgifford#77: comments-node-unpublished-867830-77.patch queued for re-testing.
Comment #80
mgiffordThere where whitespace errors in the last patch.
There were 2 failing tests in Drupal\custom_block\Tests\CustomBlockTranslationUITest but those are probably un-related. I hope..
Comment #81
shanly commented#80: comments-node-unpublished-867830-77-nowhitespace-errors.patch queued for re-testing.
Comment #83
mgiffordThis is all likely going to need to be re-written in Twig. I still don't know where the best docs are to guide the transition over from phpTemplate.
Comment #84
mgiffordThink this addresses the twig changes.
Comment #85
mgiffordGo bot.
Comment #87
mgiffordComment #88
mgiffordComment #90
mgifford#88: comments-node-unpublished-867830-87.patch queued for re-testing.
Comment #92
mgiffordre-roll
Comment #94
mgifford#92: comments-node-unpublished-867830-92.patch queued for re-testing.
Comment #96
mgiffordReroll...
Comment #98
BarisW commented#96: comments-node-unpublished-867830-96.patch queued for re-testing.
Comment #100
BarisW commented#96: comments-node-unpublished-867830-96.patch queued for re-testing.
Comment #101.0
(not verified) commentedediting
Comment #103
mgiffordReroll.
Comment #105
mgifford103: comments-node-unpublished-867830-103.patch queued for re-testing.
Comment #107
mgiffordreroll
Comment #109
mgiffordWhat happened to
return ' <span class="marker">' . t('updated') . '</span>';?The patch needs a re-roll as theme.inc has changed.
Comment #110
mgiffordThis needs to be refactored as the pink is just looking bad on the text it's sitting on too.

EDIT: Note, this is a screenshot of the unpublished node, not also the unpublished comment.
Comment #111
mgiffordComment #112
pcorbett commentedThis is a re-roll but I haven't addressed changing the "bad" aspect of aesthetic.
Comment #114
mgiffordThis really is something we should fix in D8.. It just looks bad..
Comment #115
mgiffordFatal error: Call to undefined function theme() in /core/themes/bartik/bartik.theme on line 140
$variables['unpublished'] = theme('mark', (array('type' => MARK_UNPUBLISHED)));That's probably what's causing the failures... That only popped up when adding an article.
Comment #116
mgiffordLet's try this using _theme() instead.
Comment #117
mgiffordmissed a theme()...
Edit:
That works nowin http://s53abb3f3182618d.s2.simplytest.me/Comment #118
mgiffordUnpublishing a comment looses it's state.
We really need to be able to unpublish comments....
EDIT: This is a problem in core that is unrelated to this patch.
Comment #119
mgiffordWanted to add the styling back in as per the "bad" aesthetic...
Comment #121
mgifford#119 Got the CSS wrong.. It's probably in nearly the right place, but the patch clearly needs work.
Comment #122
sutharsan commentedComment #123
mgiffordOld patch needed a reroll. Still needs styling..
Comment #124
mgiffordWell, there's styling to the node now, but it's the wrong comment.
Plus need to style the comments.
Comment #125
mgiffordI think the "Mark content" functionality is broken.
It doesn't seem to be used at all for comments from what I could tell.
With nodes it's not clear how to set it. the only place I could see it being set was drupal_common_theme() and with MARK_NEW. Not sure how to get it to be another mark logically.
Is this better documented somewhere?
Comment #127
mgiffordComment #128
xjmThis was tagged for committer feedback back in 2010 as to whether it could be allowed in D7, so I'm going to remove this tag. ;) The issue could use an up-to-date summary, though. The approach in the patch with the constant seems off to me, and doesn't seem to have anything to do with fixing a WCAG violation. I've added a beta evaluation as best I understand it, but please correct and add up-to-date details to the summary.
Comment #129
xjmComment #130
mgiffordComment #131
davidhernandezPretty sure that shouldn't be there.
Adding needs reroll, because I assume after 2 months it's gunna to need it. Lets get this finished.
Comment #132
manuel garcia commentedRerolling #125
Comment #133
manuel garcia commentedOn #125:
Omitted in the reroll
$node is not available here, so this chunk we will have to figure out I suppose.
I have left it there, commented as in the previous patch.
Core had changed the padding here, and had removed the margin.
I have changed that to have our styles, we can figure out if we broke something later on.
Attached the reroll.
Comment #135
manuel garcia commentedComment #136
mgifford1. Thanks. Sorry that got left in there.
2. So if we don't have access in node_mark() can we bring this into mark.html.twig - certainly the docs in that template should be changed to include references to MARK_UNPUBLISHED
3. I was going to capture a screenshot, but hit "Fatal error: Call to undefined function _theme()". Looks like _theme() got removed. Not sure what to replace it with.
Comment #137
akalata commentedComment #138
akalata commentedAt some point since #1939092: Convert theme_mark() to Twig, theme_mark() was returned (it had been removed). I'm thinking we need a new issue to bring back the marker, then continue with this issue that's focused on the styling?
I've attached a reroll that also attempts to address 2 and 3 from #136. Fixed the WSOD, but doesn't make the marker show up.
Also, is the "unpublished" marker something that should be in core, or just in Bartik?
Comment #139
akalata commentedComment #140
mgiffordThis is a screenshot of unpublished node & comment

The 1st comment is unpublished the 2nd is published. There's no difference if the node is unpublished. Probably not all that important.
Thanks for letting me know what did happen to theme_mark(). Setting up a new issue to add back in the marker would probably make sense. So postpone this one until that one is fixed....
It's important to have the semantic information available to let screen readers know that something is published or unpublished. Right now there is no way to indicate this.
I do think this should be a pattern in Core for all themes & not just Bartik & Seven. We want the default unpublished text to contain information in it which improves accessibility & usability. Being able to clearly know what nodes are unpublished will help with this.
Comment #142
mgiffordPatch no longer applies.
Comment #144
timmillwoodComment #145
manuel garcia commentedComment #146
manuel garcia commentedRerolling...
Comment #147
manuel garcia commentedRerolled.
Comments on the conflicts fixed:
The file system.theme.css is now gone, placed these on /core/themes/bartik/css/components/node.css
Someone from the Bartik team should take a look at this change.
This was moved onto core/modules/system/css/components/form.theme.css - removed from there now.
This file now contains no markup, so I added this without the span.
Made the change as well inside core/themes/classy/templates/content/mark.html.twig with the span class="marker"
This whole file's markup was redone, so ive added as what I see the equivalent place as it was before. We should probably do testing on this.
I've also added the changes we make to node and comment templates on the classy theme.
Comment #149
hussainwebFixing several nits and hopefully the errors. Details in interdiff.
Comment #150
hussainwebPlease revert file mode changes on commit (or in the next patch). I am not sure why they happened.
Comment #151
manuel garcia commentedThanks @hussainweb for fixing the failing tests!
Restoring the file mode changes...
Comment #152
mgiffordGlad to see progress here. Took a look at the patch. Now technically, the light grey/pink really don't have enough colour contrast, but they are really, really big http://leaverou.github.io/contrast-ratio/#%23FFF4F4-on-%23d8d8d8
Anyways, I don't think we can deal with that as we really want it to be a background to the main black text.
I attached to screenshots though of problems with the CSS.
When the screen is reduced, the text extends beyond the left hand margin of the text for the node body. It also gets cut off for the comment body. It's hard to tell but both the node & comment are unpublished here:
Also, if the body is published but the comment isn't the 'unpublished' text just doesn't show up:
I think the unpublished text needs to be re-sized based on the size of the body that contains it.
Comment #153
lewisnymanSorry to push this issue in another direction but I'm not feeling this new design either. How about we have something like this instead?

Comment #154
manuel garcia commented@LewisNyman I like that idea better because you can see better how the node will look like after you publish it.
Comment #155
mgiffordThat looks way better. I've got no problem with that approach. We'd need to make sure it was accessible in its implementation, but something like that would be as visible as what we have now (if not more so).
Comment #156
davidhernandezYeah, I'd much rather have a label than the background. I've always disliked the background because the interference with the node's display.
Comment #157
emma.mariaI like the label concept. I think its a nice improvement and gets rid of the pink background :-)
Comment #158
yoroy commentedNice one! This makes a lot of sense. Color choice in line with the style guide as well :-)
Comment #159
Bojhan commentedThis would also be my prefered way of doing it, the only challenge is that no one ever themes this stuff. So it needs to look really good by default and/or we should show a very nice looking practice in Bartik
Comment #160
lewisnymanYeah this styling should go into Classy, like with the messages.
Comment #161
emma.mariaComment #162
mgifford@Bojhan It would be great if it looked really good by default. However, I'd settle for it looking better than what we have now & being accessible.
@LewisNyman are you going to write up a patch for review? Maybe this can be fixed up quickly now that we've got a critical mass of folks who seem to like this approach.
Comment #163
lewisnymanI went quite far with this patch. I seemed quite difficult to add this to the title and all the unpublished logic is in the node.html.twig file. I realised that we had to solve the same problem. for comments, so I created a reusable component that could be used in other situations going forward. It has similar success/warning/error options that messages does. This could probably get turned into a theme component in 8.1.
Comment #165
googletorp commentedClean up comments for the new CSS, so they are consistent with the other component CSS files.
Comment #169
rainbowarray#2476947: Convert "title" page element into a block in theory could help with this if you want unpublished after the titled, as it could allow the unpublished badge to be added to title_suffix with a preprocess_page_title as Shortcut module will do if that goes in.
Comment #170
lewisnyman@googletorp Do you think that the information before was more useful than the information your replaced it with?
Comment #171
markhalliwellNo one's ever really "themed" it because there wasn't really anything to theme before. It was just a class that allowed you to change very little about the div in question. This is technically replacing this existing implementation with a whole new, and entirely separate, element to be themed. I know for a fact that people do theme the new/updated labels found elsewhere through out the site (e.g. admin content view, comments).
No, what this issue should now be proposing is to add a new "mark" type (node_mark() and mark.html.twig), not introducing a whole new (and separate) "status label" element.
Subsequently, this is now a feature request and no longer a bug. Especially considering that this is now adding new elements and removing old ones (which is technically a BC break btw, someone may actually be using this class and introducing their own :before pseudo element).
So we're using Seven's style guide for Bartik now? I understand that Bartik doesn't actually have a style guide, but this somehow seems like a very wrong direction to be heading towards.
I agree with adding a label for this information, however not so much with the color choice. It looks rather out of place. I would prefer that we keep this in the red hue range.
Comment #172
yoroy commentedI was under the impression that this was a generic solution. Since the checkbox for 'edit content in the admin theme' is on by default in standard profile it seems a good default to base this off of Seven. Wouldn't hurt to pick a better color for Bartik indeed.
I don't see how a different kind of solution turns the initial problem from bug into feature request though.
Comment #173
lewisnymanWe are fixing a bug by designing a solution that is reusable. I don't consider this a feature request. This is the right way to solve these kinds of problems. Also, we can break markup BC before Release Candidate 1.
Ah nice, it would be great to make this a simple template that we can apply the classes to. Could you help with this? We still have time before RC.
We use the Seven style guide colors for messages, the Seven style guide is the closest we have to a color scheme, if Bartik wants to override the defaults then we could do that. It doesn't at the moment though.
Red means "error". I imagine a workflow state like "needs work" would use this status. Unpublished seems more important that just "information" but less important than "something is wrong".
Comment #174
googletorp commented@LewisNyman I figured that we want consistency in core and comments that abide the coding standards, both got fixed with the patch I made.
Comment #175
emma.maria@googletorp:
Admin components are a lot more complex than components in a standard visual theme and may need more description. I think the comment change in #165 gives the user less detailed information, which is not what the coding standards suggest.
— https://www.drupal.org/node/1887862#comments
Comment #176
googletorp commented@emma.maria Coding standards dictate that the file doc should be
• 1 line explaining the the file is about
• optionally a blank line and a more detailed description
The initial line is too long and doesn't explain what is in this file and there is no blank line.
The comment explains what a status label is, it should be explaining what the file is used for (visual styles for status labels).
Also I would like to argue that we shouldn't document what a component is, in a CSS file, since that doesn't have anything to do with what the component is, only how it should appear on the screen. This documentation should be in the node module or wherever we define this.
The reference to the files could be ok, but I opted out of this, since it's not done anywhere else.
Comment #177
googletorp commentedAnyways the file comment is a small thing, I believe it's more important to actually solve the issue.
Lets gets a working patch first before discussing comments anymore, I would hate to take the focus away from the most important thing here. If you want to change the comment, then fine by me, but please fix grammar and the overall standards for comments (so machines like api.drupal.org can read the comments and expose them to users).
Comment #178
yoroy commentedA somewhat related issue at least for how we choose to style this in #2290101: UI telling you a field is shared across languages is way too subtle
Comment #179
manuel garcia commentedComment #180
yoroy commentedAh, thanks :)
Comment #181
emma.mariaThe patch needed a reroll.
Comment #182
emma.mariaComment #185
lewisnymanI had a discussion with Maouna about #2290101: UI telling you a field is shared across languages is way too subtle and how we can share the same implementation. If we take @markcarver's recommendation and reuse mark.html.twig we are going to have to expand it considerably to accommodate more than just the node markers.
This is the code that they would expect to use in #2290101: UI telling you a field is shared across languages is way too subtle:
The current mark.twig.html implementation looks like this:
We'd have to open it up so you can pass any status in there, and also remove the logged in requirement, which seems like a weird layer to check for this anyway.
Comment #186
lewisnymanHere's a patch that completely rewrites the implementation of mark.html.twig. No big deal. Look at these lovely markers.

Comment #188
lewisnymanWhoops. Somehow I missed that I had already applied a patch.
Comment #192
nlisgo commentedMe and @thewilkybarkid will be looking to address the failing tests! Wish us luck!
Comment #193
emma.mariaGood luck :)
Comment #194
nlisgo commentedI will be reviewing the code changes and @thewilkybarkid will be looking into some of the failing tests.
Comment #195
nlisgo commentedThese constants are still referred to in mark.html.twig
'admins' also needs to be removed if you are getting rid of node--unpublished
Comment #196
nlisgo commentedThis condition causes an exception to be thrown if $variables['status'] is undefined.
This patch address this.
Comment #197
thewilkybarkid commentedThis updates 3 XPath queries to match the HTML changes. The tests should now all pass.
Comment #199
nlisgo commentedThe feedback in #195 still needs to be addressed. I'm unclear what we need to do with mark.html.twig because it is completely redundant right now. Can someone who has an idea what we want the default markup to be take that on?
Comment #200
akalata commentedComment #201
mgiffordI don't have anything to add @nlisgo but looking for answers too.
We have to consider the comments too:

Decided to add this screenshot from a mobile device.
It's looking good.
Comment #202
nlisgo commentedAddressing feedback in #195. Can someone verify that the markup in the default mark.html.twig file is as expected.
Comment #204
mgiffordThe MARK_NEW, MARK_UPDATED, & MARK_READ were removed from what was theme_mark() in comment #186. This might need a broader discussion. I remember them coming in, but not sure where. There's an argument against removing them from #1311372-13: Use <mark> element for 'mark' theme hook but they aren't very flexible as @Jacine points out and I don't know who uses them.
I've got nothing against using
<mark>but but we should be clear about introducing this.EDIT: We also really need to test this in the forums with new, updated & read content.
Comment #205
lewisnymanSorry for overbaking the patch :P
Comment #206
mgiffordThat's fine. I just want to make sure we're not introducing any regressions with this patch.
Comment #207
Bojhan commentedThis probably shouldn't be using the mark tag, thats to be used for highlighting.
The design approach looks solid.
Comment #208
lewisnymanI am happy to move
<mark>into #1311372: Use <mark> element for 'mark' theme hook an then we don't have to have this discussion here.Comment #209
yesct commentedI put one of the after screenshots from #201 in the issue summary.
Recent before screenshots are also needed.
Probably also before and after markup would be useful to also put in the summary.
Comment #210
gábor hojtsyLet's move the mark tag there and then we can get this in ASAP. Highly interested given #2290101: UI telling you a field is shared across languages is way too subtle depends on this one. Also:
Spacing code style issues.
Comment #211
gábor hojtsyComment #212
Maouna commentedComment #213
Maouna commentedFixed the spacing mentioned in #210.
Comment #214
lewisnymanSetting to needs work to remove the mark HTML element from mark.html.twig. Let's keep using a span instead.
Comment #215
strykaizer#213 with mark tag removed, and marker.css readded (seems to have been lost in the patches somewhere).
Comment #217
strykaizer#213 with mark tag removed, and marker.css readded (seems to have been lost in the patches somewhere).
Comment #218
yesct commentedupdated issue summary, noting #2290101: UI telling you a field is shared across languages is way too subtle is postponed on this.
Comment #219
wim leers<3
Why the early rendering? Let Twig do the rendering. So that the cacheability metadata and assets for this are not bubbled if it's not actually printed in the template.
Same.
This seems wrong.
<3
Wrong again.
<3
Comment #220
yesct commentedadded before to the summary. there will probably be markup changes, when the patch is ... done.. we should get a new after screenshot and markup.
Comment #221
lewisnymanWorkin' on it
Comment #222
lewisnymanComment #223
lewisnymanHere are screenshots in Classy and Bartik:
Comment #226
yesct commentedneeds an issue summary update, updating if it is allowed in rc. https://www.drupal.org/core/d8-allowed-changes
Comment #227
eiriksmJust fixing the test failure in #222.
For the record. Interdiff in #222 seemed to address all concerns from #219
Comment #229
eiriksm...oops. A bit fast there.
_this_ should fix the tests :)
Comment #230
mgifford@YesCT - the issue summary looks pretty solid at this point. I'd only add the final html output when the final patch is agreed to. I think we can remove the "Needs issue summary update" unless we get more guidance about what is needed.
Comment #231
mgiffordComment #232
mgiffordI think this satisfies the "Needs issue summary update" tag.
Comment #233
mgiffordCommenting out Unfrozen & Prioritized changes which aren't part of RC.
Comment #234
mgiffordComment #235
mgiffordComment #236
mgiffordI think this has been tested sufficiently and will greatly enhance Drupal 8 while also fixing another blocked bug.
Comment #238
Bojhan commentedThis is changing markup, so sadly 8.1
Comment #239
mgifford@Bojhan, any reason we can't bump this back to 8.0 and see if it can get in with "rc target triage"? This issue has been open for 5 years and it would be really nice to just use this implementation that we have now which looks way more professional. Especially since it unblocks another issue.
We'd need to add the
<h3>Why this should be an RC target</h3>statement of course.Comment #240
lewisnymanLet's find out!
Comment #241
lewisnymanI only found one good reason for committing this before release, which is accessibility.
Comment #243
Jeff Burnz commentedThe accessibility improvements are well worth it and it looks way more professional, lets please allow this in.
Comment #244
rootworkGiven the number of outstanding accessibility improvements in Drupal 8 -- and given the minor CSS changes and lack of disruption this feature would cause -- I definitely think this is worth allowing in the RC phase.
I do think given the addition of the
{{ markers }}variable in templates (and some people will have already started developing on earlier RCs and created their own templates) we should probably include a change record or some kind of notice. But that's a really minor addition given the number of improvements this brings.Comment #245
rootworkThis was added somewhere along the way in this issue, but the file doesn't exist. Removing this to fix the failing test.
Comment #246
mgiffordI think there's something weird with the Basic Page content type. Maybe there's just a glitch, but I can't seem to get the unpublished code to appear on that page. Works fine with articles & with new content types. Could someone else please verify if it is working for them or not.
EDIT: Wanted to add that without the patch, the light pink background still shows up just fine.
Comment #247
rootworkVerified on SimplyTest that with the patch, neither the light pink background nor the new marker shows up on unpublished basic page drafts.
If I get a chance I'll try to dig into it, but if someone else wants to work on it please do.
Comment #248
xjmWe should consider the non-accessibility of the draft state labeling a bug for sure, but I'm not sure about the design changes during RC. Tagging for product manager review for that.
Comment #249
xjmCould we start by adding the word "draft" more clearly, and split the design changes out for a minor version target? Maybe? Waiting to see what @webchick recommends.
Comment #250
webchickYeah, personally I'd feel safer pushing this to 8.1.x vs. trying to get it in now, due to markup + string freeze (invalidates books, documentation, videos, etc. for a problem that already existed in D7). The design changes look reasonable to me, but I'd love longer than a couple of weeks (we hope) to let them sink in / do any necessary clean-ups. That said, this is a fantastic improvement and I'm really looking forward to it.
I don't understand though why #2290101: UI telling you a field is shared across languages is way too subtle is postponed on this? (that one feels more major than this one, since it's a new problem introduced in D8.)
Comment #251
gábor hojtsy@webchick: well, that one is a 4 line patch that just uses the template / design / css introduced here :) So if we are to introduce it for that issue, then we need to move over a lof of what this issue proposes there :) not sure if postponing the very small that is left of this to 8.1 is good then?
Comment #252
andypostLooking through discussion I wondered why nobody suggested a javascript approach for that.
Having a
data-markattribute can make the change a BC way and will allow contrib themes to easily extend and override implementationI think this strings are too short so needs translation context
needs rtl support
Comment #253
gábor hojtsyWould be amazing to get the outstanding feedback resolved and the patch landing in 8.1 sooner than later. We would love to build on it still in 8.1 with #2290101: UI telling you a field is shared across languages is way too subtle.
Comment #254
eiriksmImplemented suggestions in #252
Comment #255
mgiffordI think this is good to go. @andypost concerns 1 & 2 are addressed.
His comments haven't been addressed:
But I think those can probably be dealt with in a separate issue. I'd like to get this issue fixed and this is a much better solution than we have.
Comment #256
emma.mariaI visually tested Bartik out and I'm not too happy with what it outputs in the UI.
When there is a "new" stamp and the unpublished marker they sit squashed together. Also the unpublished marker always sits flush to the border of the content info.
Also when one comment has a "new" and one doesn't they end up with different indentation. This can mislead comments to look like they are children of each other when they are meant to be at an equal level.
For a quick fix that makes it look much much better, can we please have the {{ marker }} printing within the ".comment__meta" markup wrapper within the template so it gets the same layout and spacing as the rest of the content below the marker?
See screenshots....
Before
After - within the wrapper.
Comment #257
yoroy commentedThat makes a lot of sense, thanks @emma.maria
Comment #258
manuel garcia commentedGood call @emma.maria. Here it is.
Comment #259
yoroy commentedLatest patch does what #256 suggests. It's not so nice that the typography differs between node and comment. Looks like that bit is Bartik specific. In Seven the labels look identical on node and comment.
Comment #262
emma.mariaSo I assume we need to remove the work that touches the Classy theme now because that is frozen until D9? Core and Bartik can still have this work though.
Comment #263
eiriksmHm, then I guess we have a problem.
This patch changes the "status" variable in the marker template to contain the status text. So if we were to leave classy alone, then it would try to compare strings to undefined constants (since this patch also removes the constants it is comparing to).
Not sure what the correct way of proceeding would be, if we can not touch classy before D9? The only other way would be to keep the constants, change the text to end up in another variable (like status_text). Keep setting the status variable to the correct constant, and use them both for BC?
Comment #264
star-szrYup using two variables seems like a sensible way forward. As much as I want to see this change everywhere we need to be very careful about changing Classy and Stable and this case may not be worth the disruption it will cause.
Comment #272
mlncn commentedWould it be easier to get this done targeting Drupal 9 directly right now, quickly?
Comment #274
lolcode commentedJust found this issue and I'm looking forward to seeing it in core.
This would need to be tested in Olivero as well so I added the related issue.
Comment #275
lolcode commentedI have attempted to re-roll the patch. I did not attempt to address the previous test failure.
Comment #276
micnap commentedComment #277
micnap commentedComment #278
micnap commentedComment #279
micnap commentedComment #281
anmolgoyal74 commentedUpdated CS issues and classy theme file hash.
Comment #282
anmolgoyal74 commentedComment #284
msutharsComment #285
msutharsComment #287
pameeela commentedComment #288
xjmThis is major due to the multiple related accessibility issues, including missing information for blind users and failing the contrast ratio.
Edit: This issue is honestly almost critical as it involves not one but two clear violations of the accessibility gate. The only reason I didn't promote it to critical is that it's been this way for more or less the entire history of Drupal.
Comment #289
xjmRemoving the legacy pre-8.0.0 beta phase evaluation (!) from the IS, although keeping the explanation of why it's a major accessibility issue. The beta evaluation had correctly identified that the issue was major and the reason for it, but somehow the issue priority didn't ever actually get set that way.
Comment #290
vsujeetkumar commentedRe-roll patch created for 9.3.x.
Comment #291
vsujeetkumar commentedFixed the "custom command fail issues".
Comment #293
vsujeetkumar commentedFixed the fail tests, Please have a look.
Comment #295
xjmThe test fail is related to a theme system issue:
Comment #296
vsujeetkumar commented@xjm the above fail test is now fixed, however I am facing the "custom command fail" issues mentioned below, Please have a look and advise.
Error: No files matching the pattern "/var/www/html/core/themes/claro/css/classy/components/node.css" were found.
at /var/www/html/core/node_modules/stylelint/lib/standalone.js:212:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Comment #300
pasqualleAs mentioned in comment #263 it would be really bad to change or remove template variables without proper notice.
see #3270148: Provide a mechanism for deprecation of variables used in twig templates
I would suggest to use a new variable "status_marker" and mark the old ones deprecated.
The list of themes changed in Drupal 10, patch needs to be updated.
Requires a change record, with a possible explanation how to use the status marker with custom content entities with status, for example paragraphs. Also how to use it in custom themes.
Comment #301
mgiffordAdding WCAG SC 1.4.1
Comment #303
ricksta commentedI have nothing new to add here other than to say I support the approach and points brought up in 300.
Comment #304
vsujeetkumar commentedRe-roll patch created for 11.x. And keeps as in "Need work" because some of the comments are still unaddressed.
Some of the theme files changes has been removed because of those are not part of current version.
Comment #305
mgifford@vsujeetkumar it has been 2 years, so this will need to be re-rolled.
What comments are still unaddressed?
@pasqualle suggested an approach that @ricksta recommended. I think the summary there is new variable "status_marker" and mark the old ones deprecated.
We would need a new variable name I think.
Comment #306
lauriiiThere was a solution implemented for canonical entity routes in #3501332: Display content moderation state in the Navigation Top Bar which is worth noting here.
Comment #307
mgiffordI tried to update the patch here https://git.drupalcode.org/issue/drupal-867830/-/compare/11.x...867830-u...
The numbering may not matter, but because @lauriii is wonderful, the numbers aren't what I thought they were.
I think these are complementary issues, but definitely related.
Comment #308
markconroy commentedFor LocalGov Drupal's base theme we created some theme settings for "Add pink background to unpublished items" and "Add "Draft:" to the title of unpublished nodes.
I'm not suggesting we create theme settings here, but the approach of prepending "Draft" to titles has worked very well for councils, and does not affect the length of the title very much. So instead of a node title like "Council Tax" you get "Draft: Council Tax", with the option to also add the pink background (which is a CSS variable so you can put whatever colour you want in via CSS).