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

A11y: Make Annotations and Template Variables list and edit pages responsive #71791

Merged

Conversation

juanicabanas
Copy link
Contributor

@juanicabanas juanicabanas commented Jul 17, 2023

What is this feature?

It makes annotations, template variables and edit template variables configuration pages responsive.

Which issue(s) does this PR fix?:

Fixes #66487

Special notes for your reviewer:
Since there are tables inside these pages, it's not possible to avoid the horizontal scrolling behavior.
I fixed the responsive design.

Annotations config page

annotations_page.mov

Template variables config page

variables_page.mov

Template variables edit page

variables_edit_page.mov

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@juanicabanas juanicabanas added this to the 10.1.x milestone Jul 17, 2023
@juanicabanas juanicabanas self-assigned this Jul 17, 2023
@juanicabanas juanicabanas requested review from a team as code owners July 17, 2023 19:36
@juanicabanas juanicabanas requested review from polibb, kaydelaney, tskarhed and eledobleefe and removed request for a team July 17, 2023 19:36
const value = useMemo(
() => REFRESH_OPTIONS.find((o) => o.value === refresh)?.value ?? REFRESH_OPTIONS[0].value,
[refresh]
);

return (
<Field label="Refresh" description="When to update the values of this variable">
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} />
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} size={width < 375 ? 'sm' : 'md'} />
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is a good solution (not worth it, and just makes code messy, and not a pattern we use anywhere else )

Copy link
Member

Choose a reason for hiding this comment

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

beside the radio button fits on small screens. I would change the wording instead "on time range change" to just "On time change"
Screenshot 2023-07-24 at 20 54 23

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'm also wondering how much responsive we should be since a 320px mobile device is not a common one anymore.
Changing the wording keeps generating some problems, since there's a minimal horizontal scrolling and no padding. Shouldn't we decrease the padding a little bit more, in this case?
image

@torkelo
Copy link
Member

torkelo commented Jul 24, 2023

Not sure how scrolling just the table is better than scrolling the page? is not scrolling the page a bit more discoverable?

Copy link
Contributor

@ivanortegaalba ivanortegaalba left a comment

Choose a reason for hiding this comment

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

I left small comments, but the changes look great. Thanks @juanicabanas to take care of this!

</Droppable>
</DragDropContext>
</table>
<div style={{ overflow: 'scroll', width: '100%' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use here emotion as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes! I didn't catch it

@@ -14,14 +15,15 @@ const REFRESH_OPTIONS = [
];

export function QueryVariableRefreshSelect({ onChange, refresh }: PropsWithChildren<Props>) {
const { width } = useWindowSize();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use useMediaQueryChange hook? This will only trigger a re-render when the media query changes, not when the window size changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

loved it. didn't know it

const value = useMemo(
() => REFRESH_OPTIONS.find((o) => o.value === refresh)?.value ?? REFRESH_OPTIONS[0].value,
[refresh]
);

return (
<Field label="Refresh" description="When to update the values of this variable">
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} />
<RadioButtonGroup options={REFRESH_OPTIONS} onChange={onChange} value={value} size={width < 375 ? 'sm' : 'md'} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why don't we set a width and the labels are automatically truncated? I like this improvement anyways, although md works for screens like iPhone SE already.

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 just tried it and it seems it's not possible with the RadioButtonGroup we currently have. I should make some modifications to that core component

@juanicabanas
Copy link
Contributor Author

Not sure how scrolling just the table is better than scrolling the page? is not scrolling the page a bit more discoverable?

@torkelo I think it's better since otherwise, the whole page would look as broken

@torkelo
Copy link
Member

torkelo commented Jul 27, 2023

@juanicabanas yea, your right. just feels like this just hides the problem but maybe with more rows in the table it's easier to notice

Copy link
Contributor

@ivanortegaalba ivanortegaalba left a comment

Choose a reason for hiding this comment

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

Thanks for applying the feedback, LGTM!

@ivanortegaalba ivanortegaalba merged commit 66cea5a into main Jul 28, 2023
16 checks passed
@ivanortegaalba ivanortegaalba deleted the juanicabanas/responsive-config-dashboard-section-a11-bug branch July 28, 2023 13:09
@grafana-delivery-bot grafana-delivery-bot bot modified the milestones: 10.1.x, 10.2.x Jul 28, 2023
chauchausoup pushed a commit to chauchausoup/grafana that referenced this pull request Sep 15, 2023
@zerok zerok modified the milestones: 10.2.x, 10.2.0 Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
5 participants