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

Added the disabled state to the disabled attribute on the native html button #472

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/ui-switch/ui-switch.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
type="button"
class="switch"
role="switch"
[disabled]="disabled"
Copy link
Collaborator

@cmckni3 cmckni3 Nov 4, 2023

Choose a reason for hiding this comment

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

Suggested change
[disabled]="disabled"
[attr.disabled]="disabled ? 'disabled' : null"

Copy link
Author

Choose a reason for hiding this comment

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

I'll give this change a try, but I don't think it works with the disabled attribute. I've had issues in the past where you end up with disabled="false" in the DOM, and the element is actually disabled.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh yeah. That's right.

It's due to being an attribute. Luckily, this is a button. It should be disabled="disabled" when actually disabling or not have the the attribute at all.

See updated suggsetion and let me know if that helps.

[attr.aria-checked]="reverse ? !checked : checked"
[attr.aria-label]="ariaLabel"
[class.checked]="reverse ? !checked : checked"
Expand Down