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

chore(button): CSS for icon-only attribute #3716

Merged
merged 8 commits into from
Nov 7, 2023
Merged

Conversation

Rajdeepc
Copy link
Contributor

@Rajdeepc Rajdeepc commented Oct 11, 2023

Description

Added CSS for icon-only attribute for sp-button

Motivation and context

To solve the below issue on a rounded button with icon
Screenshot 2023-10-11 at 7 01 14 PM

How has this been tested?

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@Westbrook
Copy link
Contributor

FYI: #3398

@Rajdeepc
Copy link
Contributor Author

@najikahalsema @Westbrook If everything looks good here can we merge this?

@github-actions
Copy link

github-actions bot commented Oct 31, 2023

Tachometer results

Chrome

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 487 kB 94.11ms - 95.60ms - unsure 🔍
-0% - +2%
-0.33ms - +1.62ms
branch 473 kB 93.57ms - 94.84ms unsure 🔍
-2% - +0%
-1.62ms - +0.33ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 516 kB 118.14ms - 120.26ms - unsure 🔍
-1% - +1%
-1.72ms - +1.26ms
branch 503 kB 118.38ms - 120.48ms unsure 🔍
-1% - +1%
-1.26ms - +1.72ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 538 kB 74.92ms - 76.31ms - unsure 🔍
-1% - +2%
-0.56ms - +1.41ms
branch 524 kB 74.49ms - 75.89ms unsure 🔍
-2% - +1%
-1.41ms - +0.56ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 640 kB 188.74ms - 192.48ms - unsure 🔍
-1% - +2%
-2.34ms - +3.22ms
branch 626 kB 188.11ms - 192.23ms unsure 🔍
-2% - +1%
-3.22ms - +2.34ms
-

alert-dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 454 kB 131.65ms - 133.61ms - unsure 🔍
-1% - +1%
-1.10ms - +1.32ms
branch 441 kB 131.81ms - 133.24ms unsure 🔍
-1% - +1%
-1.32ms - +1.10ms
-

button-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 442 kB 67.04ms - 68.70ms - unsure 🔍
-1% - +2%
-0.76ms - +1.59ms
branch 428 kB 66.62ms - 68.28ms unsure 🔍
-2% - +1%
-1.59ms - +0.76ms
-

button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 448 kB 82.15ms - 83.41ms - unsure 🔍
-1% - +1%
-1.17ms - +0.79ms
branch 434 kB 82.21ms - 83.72ms unsure 🔍
-1% - +1%
-0.79ms - +1.17ms
-

dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 508 kB 91.14ms - 92.02ms - faster ✔
1% - 2%
1.13ms - 2.32ms
branch 495 kB 92.91ms - 93.71ms slower ❌
1% - 3%
1.13ms - 2.32ms
-

infield-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 402 kB 21.62ms - 21.85ms - unsure 🔍
-0% - +1%
-0.10ms - +0.21ms
branch 388 kB 21.58ms - 21.79ms unsure 🔍
-1% - +0%
-0.21ms - +0.10ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 462 kB 249.70ms - 253.54ms - faster ✔
0% - 3%
0.87ms - 6.77ms
branch 448 kB 253.20ms - 257.68ms slower ❌
0% - 3%
0.87ms - 6.77ms
-

number-field permalink

Version Bytes Avg Time vs remote vs branch
npm latest 518 kB 103.73ms - 105.50ms - unsure 🔍
-1% - +2%
-0.72ms - +2.26ms
branch 504 kB 102.65ms - 105.04ms unsure 🔍
-2% - +1%
-2.26ms - +0.72ms
-

overlay permalink

Version Bytes Avg Time vs remote vs branch
npm latest 505 kB 59.56ms - 60.44ms - unsure 🔍
-0% - +2%
-0.28ms - +0.97ms
branch 495 kB 59.21ms - 60.09ms unsure 🔍
-2% - +0%
-0.97ms - +0.28ms
-

picker-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 414 kB 48.20ms - 48.67ms - unsure 🔍
-1% - +1%
-0.32ms - +0.35ms
branch 401 kB 48.18ms - 48.66ms unsure 🔍
-1% - +1%
-0.35ms - +0.32ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 506 kB 657.67ms - 667.99ms - unsure 🔍
-0% - +2%
+0.00ms - +12.86ms
branch 492 kB 652.56ms - 660.24ms faster ✔
0% - 2%
0.00ms - 12.86ms
-

popover permalink

Version Bytes Avg Time vs remote vs branch
npm latest 383 kB 23.81ms - 23.99ms - unsure 🔍
-2% - +0%
-0.60ms - +0.08ms
branch 369 kB 23.84ms - 24.49ms unsure 🔍
-0% - +3%
-0.08ms - +0.60ms
-

search permalink

Version Bytes Avg Time vs remote vs branch
npm latest 474 kB 65.52ms - 66.55ms - unsure 🔍
-4% - +1%
-2.37ms - +0.61ms
branch 460 kB 65.52ms - 68.31ms unsure 🔍
-1% - +4%
-0.61ms - +2.37ms
-

slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 471 kB 120.64ms - 122.62ms - slower ❌
0% - 2%
0.19ms - 2.75ms
branch 457 kB 119.35ms - 120.97ms faster ✔
0% - 2%
0.19ms - 2.75ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 712 kB 1852.55ms - 1855.17ms - unsure 🔍
-0% - +0%
-3.12ms - +1.61ms
branch 698 kB 1852.65ms - 1856.59ms unsure 🔍
-0% - +0%
-1.61ms - +3.12ms
-

tags permalink

Version Bytes Avg Time vs remote vs branch
npm latest 458 kB 22.87ms - 24.23ms - unsure 🔍
-5% - +4%
-1.20ms - +0.86ms
branch 444 kB 22.94ms - 24.49ms unsure 🔍
-4% - +5%
-0.86ms - +1.20ms
-

toast permalink

Version Bytes Avg Time vs remote vs branch
npm latest 436 kB 49.59ms - 51.73ms - unsure 🔍
-2% - +4%
-0.85ms - +1.81ms
branch 422 kB 49.40ms - 50.98ms unsure 🔍
-4% - +2%
-1.81ms - +0.85ms
-

tooltip permalink

Version Bytes Avg Time vs remote vs branch
npm latest 568 kB 52.45ms - 53.18ms - unsure 🔍
-2% - +0%
-1.01ms - +0.11ms
branch 539 kB 52.84ms - 53.68ms unsure 🔍
-0% - +2%
-0.11ms - +1.01ms
-
Firefox

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 487 kB 408.16ms - 427.60ms - unsure 🔍
-4% - +3%
-15.51ms - +14.43ms
branch 473 kB 407.04ms - 429.80ms unsure 🔍
-3% - +4%
-14.43ms - +15.51ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 516 kB 590.52ms - 608.60ms - unsure 🔍
-3% - +3%
-16.35ms - +15.43ms
branch 503 kB 586.96ms - 613.08ms unsure 🔍
-3% - +3%
-15.43ms - +16.35ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 538 kB 372.24ms - 393.00ms - unsure 🔍
-4% - +3%
-14.34ms - +12.74ms
branch 524 kB 374.73ms - 392.11ms unsure 🔍
-3% - +4%
-12.74ms - +14.34ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 640 kB 588.92ms - 615.00ms - unsure 🔍
-5% - +1%
-30.34ms - +9.02ms
branch 626 kB 597.88ms - 627.36ms unsure 🔍
-2% - +5%
-9.02ms - +30.34ms
-

alert-dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 454 kB 426.43ms - 452.21ms - unsure 🔍
-2% - +6%
-9.15ms - +24.71ms
branch 441 kB 420.56ms - 442.52ms unsure 🔍
-6% - +2%
-24.71ms - +9.15ms
-

button-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 442 kB 360.06ms - 370.54ms - unsure 🔍
-5% - +1%
-17.36ms - +5.04ms
branch 428 kB 361.56ms - 381.36ms unsure 🔍
-1% - +5%
-5.04ms - +17.36ms
-

button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 448 kB 385.42ms - 398.22ms - unsure 🔍
-3% - +2%
-12.75ms - +7.55ms
branch 434 kB 386.54ms - 402.30ms unsure 🔍
-2% - +3%
-7.55ms - +12.75ms
-

dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 508 kB 244.61ms - 261.19ms - unsure 🔍
-5% - +4%
-11.65ms - +10.85ms
branch 495 kB 245.69ms - 260.91ms unsure 🔍
-4% - +5%
-10.85ms - +11.65ms
-

infield-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 402 kB 112.00ms - 128.68ms - unsure 🔍
-5% - +13%
-5.77ms - +14.93ms
branch 388 kB 109.63ms - 121.89ms unsure 🔍
-12% - +5%
-14.93ms - +5.77ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 462 kB 861.58ms - 898.98ms - unsure 🔍
-1% - +3%
-11.99ms - +30.19ms
branch 448 kB 861.43ms - 880.93ms unsure 🔍
-3% - +1%
-30.19ms - +11.99ms
-

number-field permalink

Version Bytes Avg Time vs remote vs branch
npm latest 518 kB 472.88ms - 490.56ms - unsure 🔍
-4% - +2%
-19.31ms - +8.47ms
branch 504 kB 476.42ms - 497.86ms unsure 🔍
-2% - +4%
-8.47ms - +19.31ms
-

overlay permalink

Version Bytes Avg Time vs remote vs branch
npm latest 580 kB 279.76ms - 292.80ms - unsure 🔍
-2% - +3%
-4.88ms - +9.76ms
branch 566 kB 280.52ms - 287.16ms unsure 🔍
-3% - +2%
-9.76ms - +4.88ms
-

picker-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 414 kB 190.04ms - 204.12ms - unsure 🔍
-7% - +6%
-14.30ms - +12.42ms
branch 401 kB 186.66ms - 209.38ms unsure 🔍
-6% - +7%
-12.42ms - +14.30ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 506 kB 1502.29ms - 1532.47ms - unsure 🔍
-3% - +2%
-49.15ms - +32.31ms
branch 492 kB 1487.97ms - 1563.63ms unsure 🔍
-2% - +3%
-32.31ms - +49.15ms
-

popover permalink

Version Bytes Avg Time vs remote vs branch
npm latest 383 kB 134.04ms - 156.32ms - unsure 🔍
-10% - +8%
-15.00ms - +11.96ms
branch 369 kB 139.11ms - 154.29ms unsure 🔍
-8% - +10%
-11.96ms - +15.00ms
-

search permalink

Version Bytes Avg Time vs remote vs branch
npm latest 474 kB 248.21ms - 262.39ms - unsure 🔍
-6% - +2%
-16.55ms - +6.47ms
branch 460 kB 251.27ms - 269.41ms unsure 🔍
-3% - +7%
-6.47ms - +16.55ms
-

slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 471 kB 453.86ms - 474.78ms - unsure 🔍
-6% - +1%
-28.06ms - +2.94ms
branch 457 kB 465.44ms - 488.32ms unsure 🔍
-1% - +6%
-2.94ms - +28.06ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 712 kB 1652.80ms - 1668.56ms - unsure 🔍
-1% - +0%
-17.17ms - +1.97ms
branch 698 kB 1662.85ms - 1673.71ms unsure 🔍
-0% - +1%
-1.97ms - +17.17ms
-

tags permalink

Version Bytes Avg Time vs remote vs branch
npm latest 458 kB 79.46ms - 89.82ms - unsure 🔍
-15% - +6%
-13.28ms - +5.80ms
branch 444 kB 80.38ms - 96.38ms unsure 🔍
-7% - +16%
-5.80ms - +13.28ms
-

toast permalink

Version Bytes Avg Time vs remote vs branch
npm latest 436 kB 242.04ms - 255.88ms - unsure 🔍
-4% - +4%
-10.40ms - +9.80ms
branch 422 kB 241.89ms - 256.63ms unsure 🔍
-4% - +4%
-9.80ms - +10.40ms
-

tooltip permalink

Version Bytes Avg Time vs remote vs branch
npm latest 645 kB 211.74ms - 215.82ms - faster ✔
1% - 5%
2.72ms - 12.00ms
branch 631 kB 216.98ms - 225.30ms slower ❌
1% - 6%
2.72ms - 12.00ms
-

Copy link
Collaborator

@najikahalsema najikahalsema left a comment

Choose a reason for hiding this comment

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

Disregard my approval. Can you investigate why the build is failing to meet test coverage in chromium?

@Rajdeepc Rajdeepc linked an issue Nov 6, 2023 that may be closed by this pull request
1 task
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

Some things for this:

  • please add stories with the icon only button in isolation so we can manage it via regression testing

  • Should a user be able to set buttonRef.iconOnly = true or do we want to require buttonRef.toggleAttribute('icon-only', true)? Either way works, but we should add content about this to the documentation site based on the decisions we make there for today.

  • see https://spectrum.adobe.com/page/button/#Label-and-icon, particularly:

    The label can be hidden to create an icon-only button. If the label is hidden, an icon is required, and the label will appear in a tooltip.

    I'm OK not to block on that, though it would be nice to have this feature, too. We can land this for Coachmark work as is (with stories) and then keep [Feat][Button]: Support icon-only attribute #3398 open for the follow up work around a Tooltip.

@Rajdeepc Rajdeepc requested a review from Westbrook November 7, 2023 11:02
@Rajdeepc Rajdeepc added enhancement New feature or request Component: Button labels Nov 7, 2023
@Rajdeepc
Copy link
Contributor Author

Rajdeepc commented Nov 7, 2023

Some things for this:

  • please add stories with the icon only button in isolation so we can manage it via regression testing

  • Should a user be able to set buttonRef.iconOnly = true or do we want to require buttonRef.toggleAttribute('icon-only', true)? Either way works, but we should add content about this to the documentation site based on the decisions we make there for today.

  • see https://spectrum.adobe.com/page/button/#Label-and-icon, particularly:

    The label can be hidden to create an icon-only button. If the label is hidden, an icon is required, and the label will appear in a tooltip.

    I'm OK not to block on that, though it would be nice to have this feature, too. We can land this for Coachmark work as is (with stories) and then keep [Feat][Button]: Support icon-only attribute #3398 open for the follow up work around a Tooltip.

@Westbrook Added the required stories and also updated the tests and docs to cater icon-only attribute for Icon Only Button element

Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

LGTM. Let's land this plane 🛬

@@ -84,7 +84,7 @@ describe('Button', () => {
it('loads default only icon', async () => {
const el = await fixture<Button>(
html`
<sp-button label="Button">
<sp-button label="Button" icon-only>
Copy link
Contributor

Choose a reason for hiding this comment

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

👏🏼 👏🏼 👏🏼

@Westbrook Westbrook dismissed najikahalsema’s stale review November 7, 2023 12:28

Tests are now passing!

@Westbrook Westbrook merged commit e236a50 into main Nov 7, 2023
8 checks passed
@Westbrook Westbrook deleted the feature/button-with-icon branch November 7, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Button enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat][Button]: Support icon-only attribute
3 participants