Comments (6)
Nice issue! It reminds me of an earlier issue about making the entire post item within a query loop clickable. Potentially related issues:
from gutenberg.
I would be careful with the final markup. Typically a clickable card solution relies on CSS positioning and a pseudo-element. A good reference for implementation would be Inclusive Components > Cards
from gutenberg.
There is a longstanding issue for this over here:
I concur about Inclusive Components being a good reference and that you'd have to be very careful with the markup as well as the editing experience – getting the implementation of this pattern right is difficult.
For instance, in the OP's example screenshot, the whole card is presumably clickable, but there's also a "add comment" link inside of it. The usual recommendation for this pattern is to avoid nested links, but if they have to exist they should have a large clickable interactive area. There is not really a way for that to be applied in the block editor in a generalized way.
There's also the question of what bit of text actually is linked, which is important for accessibility. As described in Inclusive Components, you can't just wrap the whole thing in an <a>
without creating accessibility issues. Additionally, a common thing you see in this pattern is having a "read more" tease at the bottom of the card, but if that's the linked text it's an instant accessibility failure. The headline needs to be what's linked so it would be unique.
Needless to say, this all would be very difficult for the average user to understand and manage in the editor UI. My inclination would be to make it so that you could only engage "stretched link" option if the container has one link and no other interactive elements inside of it, and once it is a stretched link then additional interactive elements could not be added.
from gutenberg.
Also any solution that changes the root element to a
is going to be a bit troublesome for block validation and could create too much complexity at the block functions level. It seems a wrapper block could keep things more organized and we could explore enforcing certain restrictions or warnings for nested links or interactive elements. With the support group
has for alternative tags, maybe it could even be explored as a variation of group.
from gutenberg.
I bet @richtabor has some good ideas here.
from gutenberg.
Good point on block validation. I could see a "Link to" setting in Group and Cover working pretty well. The complex part is getting the UX right around forbidding nested interactive elements.
from gutenberg.
Related Issues (20)
- Allow themes to side-load single block plugins HOT 4
- Pattern Overrides: Unable to set some attributes like Image block Aspect Ratio when editing the original pattern HOT 1
- Allow html in InnerBlocks component template
- Missing Webpack Automation in Text Domain, Checktextdomain and Makepot Management with WordPress Scripts
- Latest Post Block having padding/space issue when we changed its background color. HOT 1
- Post Editor: `⌘+a` shortcut closes the renaming modal and changes focus HOT 3
- Improve the readability of the external icon
- Unnecessary visible scrollbars in the site editor HOT 1
- Unexpected Error in Site Editor [Cannot read properties of undefined (reading 'id')] HOT 3
- Responsive Spacer Block with the Interactivity API template
- Review the block alignment controls
- Featured Image Panel: Text is not fully visible when dragging a file HOT 3
- Improve Lock modal description and options naming
- Version 6.6 (nightly) Front-page.html template causes unexpected error on Editor main view. HOT 4
- Gutenberg plugin v18.7, stable release July 3, 2024
- Adding duotone support to core block via filter does not enqueue front-end duotone styles/SVG HOT 4
- WP 6.6 RC 1: Image cropping fails in the block editor HOT 2
- [Flaky Test] should allow user to add and remove multiple local font files
- Docs: Interactivity API - Create a new page on "Getting Started > Fundamentals of Block Development" to introduce Interactive Blocks using iAPI
- Make usage of the `settings` icon more consistent and meaningful
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gutenberg.