backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

Allow regions titles #2647

Open klonos opened 7 years ago

klonos commented 7 years ago

Example use case: A user wants to add a title to a sidebar region, but this cannot be achieved by using title-only (content-less) custom blocks. See #2640


PR by @klonos: https://github.com/backdrop/backdrop/pull/2358

docwilmot commented 7 years ago

A user can use a title-less block with an H2 content.

jlfranklin commented 7 years ago

For that use case, wouldn't it make more sense and be more semantically correct to allow regions to have a title? The HTML would be an H# tag for the region's div, not the block's div. The block's div is the region's child, and would not, semantically, apply to the whole region.

Region Titles would be a good contrib module.

klonos commented 7 years ago

A user can use a title-less block with an H2 content.

Yes, but that implies needing to first edit the HTML text filter to allow H2 tags, or switching to code (full HTML) format and adding those tags "manually". Not as user-friendly as clicking your way in the same manner as you can add block titles. That + what @jlfranklin said about "semanticallity" <-- claiming ™️ on that word 😄

jlfranklin commented 7 years ago

I'm sorry, I think I read the title of this issue as something about adding a block with a title to a region instead of a title to the region itself. @klonos, you and I are in agreement on this.

klonos commented 7 years ago

@jlfranklin 😄 that was #2640. Its previous title was "Custom blocks are not being rendered if they have only title and no content.". Now it was re-titled and re-purposed to simply clarify things in the UI so that novice users have better understanding of how things work (and hopefully why), without having many WTFs. I have come around to realize that what I was trying to achieve was (ab)using a block in order to add a title to a region.

This issue here is in order to have it so that people can achieve that task in a more "proper" way, which will at the same time be as easy as adding a block title through the manage blocks UI plus will be resulting in things being rendered semantically correct.

klonos commented 6 years ago

OK, PR up for review that adds a "Region title" checkbox in the region config dialog:

screen shot 2018-11-06 at 9 17 13 pm

...which when checked allows to set title, heading/tag, and classes:

screen shot 2018-11-06 at 9 17 29 pm

Please do not mind the 1000s of test failures for now 😅

klonos commented 6 years ago

...I plan to make the logic a bit more elaborate/smart in order to have all blocks within a region be semantically correct if set to use headings. So for example, if the region title is set to a h2, then the titles of all blocks within that region will automatically get a h3 (unless of course their style setting is set to "dynamic"); if the region is a h3, then blocks within will get a h4, etc. But this might be a follow-up.

jenlampton commented 5 years ago

I don't think this is an 80% use case. I'm in agreement with @jlfranklin that this should be a contrib module. It would be straightforward to form_alter the region form and add these settings there.

Removing core milestone, adding tag for "contrib candidate".

jenlampton commented 5 years ago

@klonos can you elaborate more on your use-case? In my 22 years of building websites I've never needed a label for a region. Can you give me a real world example? Do you have a screenshot or can you describe what goes in a region that needs a title?

stpaultim commented 2 years ago

I'm going to vote for contrib.