-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dashboard] Pass in title to Charts #122319
Conversation
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested locally
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
@elasticmachine merge upstream |
@@ -94,7 +94,10 @@ export const gaugeFunction = (): GaugeExpressionFunctionDefinition => ({ | |||
required: false, | |||
}, | |||
}, | |||
fn(data, args) { | |||
fn(data, args, handlers) { | |||
args.ariaLabel = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure that I like the idea of mutation args
in that way. Am I right that with your changes ariaLabel
is in the acceptable arguments for that expression?
I think if we really need to take a description using that way you should:
- add
ariaLabel
into expression definition
ariaLabel: {
types: ['string'],
help: 'help text,
required: false,
},
- update expression function
fn(data, args, handlers) {
return {
type: 'render',
as: EXPRESSION_GAUGE_NAME,
value: {
data,
args: {
...args,
ariaLabel:
args.ariaLabel ??
handlers.variables?.embeddableTitle ??
handlers.getExecutionContext?.()?.description,
},
},
};
},
@flash1293 do you have any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view we don't want this to be part of the expression. Can we fetch it on the renderer and pass it to the component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see only one possibility to get title it is pass it to handlers.variables or getExecutionContext, but I don't see option how we can fetch it on renderer because ExpressionRenderHandler doesn't include something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @alexwizp here - if we use the args to pass it in, we should make it a "real" argument. I don't think it hurts having it as part of the expression interface necessarily - this allows users in Canvas to override it as well.
@ppisljar @crob611 What do you think? Does it make sense to add the ariaLabel
argument to all expression function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VladLasitsa I like how it looks now. LGTM in case of getting approvals from @ppisljar / @crob611
@elasticmachine merge upstream |
merge conflict between base and head |
💚 Build SucceededMetrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @VladLasitsa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested on dashboard and Canvas
Closes: #105131
Summary
Now we can pass aria labels to elastic charts. We decided to pass title from dashboard panel to chart as aria label for better accessibility.