I would like to see some sort of visual indication to the user that a field is required for publication. I think this would be something like indication similar to the required star (maybe a blue circle instead of a red star?)

Comments

Snugug created an issue. See original summary.

mpriscella’s picture

This was actually next on my internal roadmap! After consulting with some of the UX designers on my team we are going to test out an orange star similar to the required star so users have some frame of reference as to what the indicator is for. If it doesn't look good in practice we'll play around with some other ideas (blue circle, orange triangle, whatever), but there will be something!

Snugug’s picture

An accessibility best practice is to not distinguish items based solely on color. As such, I'd recommend not just an orange star. Keep the position and size the same for context, but changing color/shape.

mpriscella’s picture

Thanks for the feedback, that's a really good point! I'll make sure that any indicator conforms with accessibility best practice.

Snugug’s picture

Hey, curious what the status on this is. Thanks!

mpriscella’s picture

Hey! Sorry for the delay, I had been trying to determine what the best solution for adding a class to an arbitrary field element and it's a lot trickier than it seems, although I think I found a solution (hacky as it feels to me). I believe this fix is close to being done, but work has been crazy recently and I haven't had time to finish this. I'm attaching a patch of what I currently have (sorry in advance for any placeholder code), please let me know if you have any suggestions!

Known outstanding issues are:

  • Test and ensure that the class gets added to all element types.
  • Add new indicator that meets accessibility requirements (talked to the UX team at my office and they agree and are getting back to me).
  • Fix the CSS so the new indicator is positioned correctly.
Snugug’s picture

I applied your patch and I couldn't tell whether or not it was applying classes correctly. It didn't appear to be in some of my basic tests. If you can get a patch that applies the required I can help with the CSS

Snugug’s picture

I've taken another look at this patch, and while it does appear to be applying the required-on-publish class to some input element, it doesn't appear to apply it to the label of the input element, which is where the styling is applied for the Drupal standard required indicator.

In my little test, it appears to apply the required-on-publish class correctly to longform text areas, but didn't appear to apply them correctly on a number field I have, or a YouTube field I have. I don't know if updating this to apply to labels instead of fields will help w/that

mpriscella’s picture

Uploaded a new patch which adds a light blue circle to each field that is required for publishing. I'm not 100% married to the color, so if you have any suggestions please let me know!

mpriscella’s picture

Version: 8.x-1.0-beta3 » 8.x-1.0-beta4
Snugug’s picture

StatusFileSize
new9.43 KB

Huzzah! This works great!

Talked this over with the designer I work with and I think I have a thought for the indicator. We think a regular blue triangle may be better than a light blue circle as the light blue is a little hard to see against white backgrounds, and a circle vs the default red * may be a little hard to distinguish at a glance. I've taken a screenshot of what we've put together and the CSS that I'm using to get there.

One comment I see while I'm going through and testing is that the class doesn't appear to be applied correctly to fields brought in via https://www.drupal.org/project/paragraphs. That's a big usecase for us, and it'd be great if we could get that working. Actually, it appears as if it does work with Paragraphs, but there's some weird behavior between a Paragraph reference that's required and fields inside that reference that are required to save vs publish. I'm not sure I have that particular usecase right now so I think this is ok!

Indicator with Blue Triangle

.required-on-publish label::after {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 3.5px 7px 3.5px;
  border-color: transparent transparent blue transparent;
  background: transparent;
  content: '';
  margin: 0 0 .3em;
  vertical-align: super;
  display: inline-block
}
mpriscella’s picture

Great! I've added a new issue #2994476: Add Paragraphs Support so we can get this change out at least and continue a discussion on how to extend support to paragraphs there.

mpriscella’s picture

StatusFileSize
new1.16 KB

Switched the filenames while doing the interdiff :facepalm:

  • mpriscella committed 94be1bb on 8.x-1.x
    Issue #2986611 by mpriscella, Snugug: Indicate Require on Publish to...
mpriscella’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mlncn’s picture