Skip to content
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

Merged
merged 12 commits into from
Feb 7, 2022
Merged

Conversation

VladLasitsa
Copy link
Contributor

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.

@VladLasitsa
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@DianaDerevyankina DianaDerevyankina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested locally

@VladLasitsa VladLasitsa self-assigned this Feb 1, 2022
@VladLasitsa VladLasitsa added Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:skip Skip the PR/issue when compiling release notes labels Feb 1, 2022
@VladLasitsa VladLasitsa marked this pull request as ready for review February 2, 2022 09:41
@VladLasitsa VladLasitsa requested a review from a team as a code owner February 2, 2022 09:41
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

@VladLasitsa
Copy link
Contributor Author

@elasticmachine merge upstream

@@ -94,7 +94,10 @@ export const gaugeFunction = (): GaugeExpressionFunctionDefinition => ({
required: false,
},
},
fn(data, args) {
fn(data, args, handlers) {
args.ariaLabel =
Copy link
Contributor

@alexwizp alexwizp Feb 2, 2022

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:

  1. add ariaLabel into expression definition
ariaLabel: {
      types: ['string'],
      help: 'help text,
      required: false,
    },
  1. 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?

Copy link
Contributor

@stratoula stratoula Feb 2, 2022

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@flash1293 flash1293 Feb 3, 2022

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?

@VladLasitsa VladLasitsa added v8.2.0 backport:skip This commit does not require backporting and removed v8.1.0 labels Feb 3, 2022
Copy link
Contributor

@alexwizp alexwizp left a 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

@flash1293
Copy link
Contributor

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
expressionHeatmap 109 110 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
expressionGauge 8.5KB 8.5KB +57.0B
expressionHeatmap 15.8KB 15.9KB +57.0B
expressionPartitionVis 42.4KB 42.5KB +77.0B
expressionTagcloud 7.6KB 7.7KB +57.0B
lens 1.0MB 1.0MB +336.0B
visTypeTimelion 121.4KB 121.4KB +49.0B
visTypeXy 60.2KB 60.3KB +71.0B
visualizations 112.3KB 112.5KB +200.0B
total +904.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
expressionGauge 9.4KB 9.9KB +444.0B
expressionHeatmap 13.0KB 13.4KB +424.0B
expressionPartitionVis 18.8KB 20.1KB +1.3KB
expressionTagcloud 7.5KB 7.9KB +451.0B
lens 42.4KB 43.1KB +721.0B
visTypeTimelion 9.3KB 9.7KB +373.0B
visTypeXy 42.4KB 42.8KB +407.0B
total +4.0KB
Unknown metric groups

API count

id before after diff
expressionHeatmap 113 114 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @VladLasitsa

Copy link
Contributor

@flash1293 flash1293 left a 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

@VladLasitsa VladLasitsa merged commit 807c625 into elastic:main Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard] Pass in title to Charts
8 participants