backdrop-issues icon indicating copy to clipboard operation
backdrop-issues copied to clipboard

[UX][A11y] Add layout template description to list of Layout Templates

Open yorkshire-pudding opened this issue 10 months ago • 19 comments

Description of the need

I think for all layout templates it would be good to display the description if there is one on the list of Layout Templates. The UI for Flexible Layout Templates includes a description. While the images for core templates give an idea, it would be good a clear textual description of the template for accessibility. The .info files and the parser support description which is widely used for modules and themes, but doesn't appear in core or a few contrib I checked.

For flexible templates, contrib and custom templates, having the description would help site architects to remember any key features that would be too wordy to put in the name.

Proposed solution

A description column is added to the table.

Image

I have proposed descriptions for all the visible core layout templates

Alternatives that have been considered

I looked for a hook that could allow this to be contrib but I didn't see an obvious one.

Is there a Drupal or Backdrop contributed module that accomplishes this? No

EDIT: Updated to reflect revised approach of putting description in own column

Draft of feature description for Press Release (1 paragraph at most)

Backdrop now includes layout template descriptions in the list of layout templates

yorkshire-pudding avatar Feb 11 '25 11:02 yorkshire-pudding

I've added a PR with a draft description for Boxton to illustrate the context. It will need descriptions for the rest of core layout templates (suggestions welcome).

~~It will also need some more work to expose the descriptions for flexible layout templates. I've had a quick look, but I haven't yet worked out why descriptions are not returned here or where to add them in.~~

yorkshire-pudding avatar Feb 11 '25 11:02 yorkshire-pudding

This makes sense to me. If I understand correctly, @yorkshire-pudding - core templates do not currently have descriptions, is that correct?

Maybe this PR should include descriptions of core templates.

I believe that maybe the description text could be a point or two smaller, maybe softer, and better positioned.

Image

Maybe something like this:

Image

stpaultim avatar Feb 12 '25 07:02 stpaultim

Hi @stpaultim Thanks for the feedback. I wasn't sure which way to go on styling the description, but your suggestion makes sense.

Maybe this PR should include descriptions of core templates.

I have included a draft description for Boxton and had proposed that the PR would include descriptions for all. Perhaps I should put in descriptions for all so people can then improve.

yorkshire-pudding avatar Feb 12 '25 08:02 yorkshire-pudding

@stpaultim I've updated the PR with some styling in the seven theme and descriptions for all core templates that are visible. I have ignored the legacy templates as these are not displayed in the table, but can add if necessary.

Image

yorkshire-pudding avatar Feb 12 '25 09:02 yorkshire-pudding

@yorkshire-pudding Thanks. I like your changes.

I have not looked to see if we have other examples elsewhere, regarding styling of these descriptions. One thing to do, would be to look around the UI and see if we're being consistent with how things are done elsewhere. But, on it's own, I like how it looks now.

stpaultim avatar Feb 12 '25 09:02 stpaultim

Just to add that out of the box it looks like this:

Image

It is only when a flexible layout is added that Moscone Flipped and Simmons wrap to the next line

yorkshire-pudding avatar Feb 12 '25 09:02 yorkshire-pudding

I have not looked to see if we have other examples elsewhere, regarding styling of these descriptions. One thing to do, would be to look around the UI and see if we're being consistent with how things are done elsewhere. But, on it's own, I like how it looks now.

I did have a look around but couldn't see any comparable tables. The other option would be to put description in a column of its own, but then I think the styling would need to match the 'Type' column.

yorkshire-pudding avatar Feb 12 '25 09:02 yorkshire-pudding

Here is what it would look like putting the description in a column:

Image

I think that perhaps this is the better approach. It will make it consistent with Content Types:

Image

yorkshire-pudding avatar Feb 12 '25 10:02 yorkshire-pudding

@stpaultim - I've updated the PR and the issue description to reflect this new more consistent approach and I think this is a better solution. It doesn't involve adding any extra styling and will not cause wrapping around the preview image.

yorkshire-pudding avatar Feb 12 '25 10:02 yorkshire-pudding

@stpaultim - two questions when you have a chance. Am I right in thinking that because this is UX/Accessibility it could go into a bug fix release and not have to wait for a minor release? Should I make the descriptions say "A template with a ..." or "A layout template with a ..." rather than "A layout with a"?

yorkshire-pudding avatar Feb 13 '25 10:02 yorkshire-pudding

@yorkshire-pudding - You are correct in that UX issues can go into bug fix releases unless a core committer believes otherwise. In my opinion, this looks to me like the kind of change that could easily go into a bugfix release.

These are Layout templates and not layouts. So it would probably be better to refer to them as such. I wonder if we could remove that repetitive reference altogether and just say something like:

"Includes a header, top, content, bottom, and footer. This is the default template for the home page." "Includes a header, top, three columns, bottom, and footer."

I don't feel strongly about this. But, if we include the word layout, I think it needs to be layout template.

stpaultim avatar Feb 13 '25 21:02 stpaultim

I've edited the descriptions to make more concise and precise.

Image

yorkshire-pudding avatar Feb 14 '25 09:02 yorkshire-pudding

Seems like this could be in the next bug fix milestone.

quicksketch avatar Feb 20 '25 19:02 quicksketch

Will this mean we need to ask contrib maintainers to add descriptions to their custom layout templates?

NormPlum avatar Feb 21 '25 05:02 NormPlum

@NormPlum It would only mean that if a contrib maintainer includes a description in their layout templates, the description will show up. But, no description would ever be required, so it would have no negative effect if a description is not available.

stpaultim avatar Feb 21 '25 06:02 stpaultim

I like this! Finally the description field for flexible templates makes sense. So far, these don't show up anywhere (AFAIK).

I totally agree, that this provides helpful info, as the image alone (with empty alt text) isn't sufficient. Works for me!

indigoxela avatar Feb 21 '25 07:02 indigoxela

I can see that the th/td for type in the table get the "priority-low" class, but descriptions don't. So they're not collapsed on narrow screens. As they take a lot of space, I think this should get added.

indigoxela avatar Feb 21 '25 07:02 indigoxela

Nice, descriptions now collapse on narrow screens. WFM 👍

indigoxela avatar Feb 21 '25 12:02 indigoxela

Nice improvement and the code looks straight forward.

izmeez avatar Feb 23 '25 16:02 izmeez

Would anyone care to remove the "pr - needs code review" and add RTBC? Thanks PS the test failure is a CSpell fail in an unrelated part of the code.

yorkshire-pudding avatar Feb 25 '25 19:02 yorkshire-pudding

This looks good to go. 👍 And I'm assuming that @stpaultim is also happy with the outcome. RTBC!

indigoxela avatar Feb 26 '25 06:02 indigoxela

Merged https://github.com/backdrop/backdrop/pull/5016 into 1.x and 1.30.x. Thank you @yorkshire-pudding, @indigoxela, @stpaultim, and @izmeez!

quicksketch avatar Mar 21 '25 04:03 quicksketch