[6.x] Add Info fieldtype - #15368
Conversation
4c3c620 to
022681e
Compare
|
@joshuablum I merged the other PR in this stack. Since this one is still in a draft, I unstacked it, and updated it for 6.x. It's standalone now ready for you to continue when you want. |
|
I wonder if we should call this "Alert" since it's really just a wrapper around the UI component already named Alert. And maybe change the |
|
I think "info" still makes more sense because that's how you'd use it - vs an "alert" which feels like describing a pop-up when in this user context. |
There was a problem hiding this comment.
I see that you named a field alert_icon just because icon was sorta reserved and getting wiped out. Instead of this workaround, I'm gonna resolve it in a separate PR. Then we can go back to using icon in here.
Also the naming I brought up earlier is fine based on what Jack said 👍
| </script> | ||
|
|
||
| <template> | ||
| <Alert :variant="variant" :icon="config.alert_icon"> |
There was a problem hiding this comment.
Warning — static field content rendered into a live ARIA region
Alert derives its ARIA semantics from the variant (resources/js/components/ui/Alert.vue:18-26): warning and error get role="alert" + aria-live="assertive", everything else role="status" + aria-live="polite". Those roles are for messages that appear in response to something the user did.
An Info field is static blueprint content. Because the publish form is client-rendered, the Alert is inserted into the DOM after load, which is exactly the case screen readers announce — so every entry-edit page load will announce the field's text, assertively for the warning and important states. A blueprint with two or three of these gets noisy fast.
Alert itself is unchanged by this PR and is fine for its existing dynamic uses; it's the new static use that doesn't fit the semantics. Suggest giving Alert an opt-out (e.g. a static / live=false prop that omits role and aria-live) and setting it from InfoFieldtype.vue.
Adds a non-data Info fieldtype for displaying visual guidance in Control Panel publish forms. It supports sanitized Markdown, built-in icon selection, and five states:
Closes statamic/ideas#1359.