Describe the bug
When registering a block type with more than 3 keywords, the following JS error is logged and the block type is not registered:
The block "xxx" can have a maximum of 3 keywords.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The current behavior is too extreme.
The block type should be registered as normal, and WP should use the first 3 keywords ignoring any others if provided. There is also no need for a JS error, or even a warning.
A silent fail would be nice for prod build, and when using dev build to provide the console warn or error. Dev feedback should be more prominent
Hi @timelsass. Can you clarify on what you mean by "silent fail"?
The block type should be registered as normal, and WP should use the first 3 keywords ignoring any others if provided.
I agree with this.
There is also no need for a JS error, or even a warning.
The warning could be helpful, but we could only show it in dev mode.
PR submitted :crossed_fingers:
@elliotcondon my bad I meant suppressing the error instead in production build - as it would still be a useful warning for people who are developing and registering blocks.
@jameelmoses should this now become console.warn since input is being accepted a modified instead of console.error?
@timelsass yeah probably. just wasn’t sure if i was allowed to change linting rules, but seems fine if console.error is being disabled
changed to console.warn
and added warn
to allow
array for linting
Related discussion: #6633.
We should just abolish this 3-keyword limit. I haven't seen anyone provide any compelling reason for why it exist, and it's certainly caused more friction than value it's provided.
PR submitted 🤞
Afore-mentioned pull request: #11953
@aduth is this something you want me to tackle? or you guys want to handle internally? im not sure if there's a series of changes that require more thought and strategy, or if it's just in this section of code.
@aduth is this something you want me to tackle? or you guys want to handle internally?
I'm not personally aware of any ongoing effort here, so feel free to take it on.
im not sure if there's a series of changes that require more thought and strategy, or if it's just in this section of code.
I _think_ it's relatively well-contained here, but I'm happy to do some more digging if you ping me for a review on a related pull request.
@aduth updated my PR to remove the restriction entirely
Landed #13848 which removes this limit altogether.
Good work @gziolo
What am I, chopped liver @elliotcondon? ¯_(ツ)_/¯
Jk ❤️
@jameelmoses Haha, sorry mate. Just looked closer at the PR.
"All work was done by @jameelmoses."
Thank you sir.
Most helpful comment
We should just abolish this 3-keyword limit. I haven't seen anyone provide any compelling reason for why it exist, and it's certainly caused more friction than value it's provided.