Skip to content

Commit

Permalink
Merge branch 'main' into fix-tooltips-opening-when-focus-is-removed-w…
Browse files Browse the repository at this point in the history
…hile-displaying
  • Loading branch information
jonrohan authored Oct 17, 2023
2 parents 483dcca + 0e7bc4d commit 88d4874
Show file tree
Hide file tree
Showing 15 changed files with 484 additions and 516 deletions.
7 changes: 7 additions & 0 deletions .changeset/mean-bottles-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@primer/view-components": minor
---

Adds an 'inactive' state to buttons. An inactive button looks disabled and has aria-disabled, but it can still be clicked and focused. This was added to support buttons that are broken due to availability issues, but can't be removed from the page.

<!-- Changed components: Primer::Beta::Button, Primer::Beta::BaseButton, Primer::Beta::IconButton -->
13 changes: 0 additions & 13 deletions .github/workflows/changesets.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ jobs:
npm ci
bundle install
# `changesets/action` depends on @changesets/cli being installed
# and we cannot add it as dependency because it conflicts with `primer-changesets-cli`
- run: npm install @changesets/[email protected]

# Use the primer GitHub App for authentication.
# See: https://github.com/organizations/primer/settings/apps/primer
- id: get-access-token
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/release_notification.yml

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/components/primer/beta/base_button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ class BaseButton < Primer::Component
# @param type [Symbol] <%= one_of(Primer::Beta::BaseButton::TYPE_OPTIONS) %>
# @param block [Boolean] Whether button is full-width with `display: block`.
# @param disabled [Boolean] Whether or not the button is disabled. If true, this option forces `tag:` to `:button`.
# @param inactive [Boolean] Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button.
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(
tag: DEFAULT_TAG,
type: DEFAULT_TYPE,
block: false,
disabled: false,
inactive: false,
**system_arguments
)
@system_arguments = system_arguments
Expand All @@ -37,6 +39,8 @@ def initialize(
"btn-block" => block
)

@system_arguments[:"aria-disabled"] = true if inactive

@disabled = disabled
return unless @disabled

Expand Down
8 changes: 6 additions & 2 deletions app/components/primer/beta/button.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@
transition: none;
}

&:disabled,
&[aria-disabled='true'] {
&:disabled {
cursor: not-allowed;
box-shadow: none;
}

&[aria-disabled='true'] {
cursor: default;
box-shadow: none;
}
}

.Button-withTooltip {
Expand Down
Loading

0 comments on commit 88d4874

Please sign in to comment.