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

[Button] Prevent the loading spinner from overlapping a monochrome outline Button’s text #5145

Conversation

Tom-Bonnike
Copy link
Contributor

@Tom-Bonnike Tom-Bonnike commented Feb 11, 2022

WHY are these changes introduced?

Fixes #5078.

WHAT is this pull request doing?

Before

Before.mov

After

After.mov

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React, {useState} from 'react';

import {Button} from '../src';

export function Playground() {
  const [isLoading, setLoading] = useState(false)

  return (
    <Button
      outline
      monochrome
      loading={isLoading}
      onClick={() => setLoading(isLoading => !isLoading)}
    >
      Lorem ipsum
    </Button>
  );
}

🎩 checklist

@Tom-Bonnike Tom-Bonnike self-assigned this Feb 11, 2022
@Tom-Bonnike Tom-Bonnike added the Bug Something is broken and not working as intended in the system. label Feb 11, 2022
@Tom-Bonnike Tom-Bonnike changed the title [Button] Prevent the loading spinner from overloading a monochrome outline Button’s text [Button] Prevent the loading spinner from overlapping a monochrome outline Button’s text Feb 11, 2022
@Tom-Bonnike Tom-Bonnike force-pushed the prevent-spinner-overlapping-button-text-monochrome-outline-loading branch from 4482c4e to a26b3b7 Compare February 11, 2022 11:54
@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2022

size-limit report

Path Size
cjs 164.57 KB (0%)
esm 94.31 KB (0%)
esnext 141.42 KB (+0.02% 🔺)
css 34.65 KB (+0.04% 🔺)

@Tom-Bonnike Tom-Bonnike force-pushed the prevent-spinner-overlapping-button-text-monochrome-outline-loading branch from a26b3b7 to 168de2c Compare February 11, 2022 11:55
@@ -392,6 +392,11 @@ $stacking-order: (
opacity: 0.4;
}

// Prevents the loading spinner from overlapping the button’s text, while retaining its width.
&.loading .Text {
opacity: 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Voiceover still properly announces it as loading once the state changes:
    Voiceover output: “Loading”

  • If I refocus the button somehow VoiceOver still picks up the button’s text:
    Voiceover output: “Lorem ipsum, website button, group busy dimmed, button, group”
    Some screen-readers might ignore it though, but I think that’s okay because it will still say the button is busy/dimmed. Not sure why the “Loading” from the Spinner doesn’t also get announced in this case though, I need to manually get into the button to target it, which seems wrong. 😅 Either way it’s rare that people would focus back to a button that’s loading.

@Tom-Bonnike Tom-Bonnike marked this pull request as ready for review February 11, 2022 12:05
@Tom-Bonnike Tom-Bonnike changed the title [Button] Prevent the loading spinner from overlapping a monochrome outline Button’s text [Button] Prevent the loading spinner from overlapping a monochrome outline Button’s text Feb 11, 2022
Copy link
Member

@chloerice chloerice 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 contributing @Tom-Bonnike!!! Couple of suggestions and this is ready to ship 🚀

UNRELEASED.md Outdated Show resolved Hide resolved
src/components/Button/Button.scss Outdated Show resolved Hide resolved
@Tom-Bonnike Tom-Bonnike force-pushed the prevent-spinner-overlapping-button-text-monochrome-outline-loading branch from 168de2c to 95b7592 Compare February 14, 2022 09:05
@Tom-Bonnike Tom-Bonnike merged commit 53e8e34 into main Feb 14, 2022
@Tom-Bonnike Tom-Bonnike deleted the prevent-spinner-overlapping-button-text-monochrome-outline-loading branch February 14, 2022 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken and not working as intended in the system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Monochrome outlined loading Button doesn’t look right
2 participants