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

feat(sbb-toggle): implement form association #3409

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TomMenga
Copy link
Contributor

@TomMenga TomMenga commented Feb 18, 2025

This PR Closes #3364

Note for reviewers
I added a few comments to clarify the decisions I took during development

@TomMenga TomMenga changed the title feat(sbb-toggle): implement form association feat(sbb-toggle): implement form association [WIP] Feb 18, 2025
@github-actions github-actions bot added pr: peer review required A peer review is required for this pull request and removed pr: peer review required A peer review is required for this pull request labels Feb 18, 2025
@github-actions github-actions bot temporarily deployed to pr3409 February 18, 2025 11:46 Inactive
@github-actions github-actions bot temporarily deployed to pr3409-diff February 18, 2025 11:46 Inactive
@TomMenga TomMenga changed the title feat(sbb-toggle): implement form association [WIP] feat(sbb-toggle): implement form association Feb 18, 2025
@TomMenga TomMenga added preview-available pr: peer review required A peer review is required for this pull request pr: lead review required A lead review is required for this pull request diff-available labels Feb 18, 2025
@TomMenga TomMenga self-assigned this Feb 18, 2025
Comment on lines -86 to -94
// Enforce disabled state from parent.
if (!this._toggle) {
// Ignore illegal state. Our expectation is that a sbb-toggle-option
// always has a parent sbb-toggle.
} else if (this._toggle.disabled && !this.disabled) {
this.disabled = true;
} else if (!this._toggle.disabled && this.disabled) {
this.disabled = false;
}
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 removed this logic to simplify the dependency between the toggle and the toggle-option.
I decided to do it for two reasons:
1 - The sbb-toggle is also disabled when formDisabled. Which is a protected property that is not accessible from the toggle option.
2 - It was a protection against a misuse case (which we generally do not cover)

@github-actions github-actions bot temporarily deployed to pr3409 February 18, 2025 13:19 Inactive
@github-actions github-actions bot temporarily deployed to pr3409-diff February 18, 2025 13:19 Inactive
Copy link
Contributor

@jeripeierSBB jeripeierSBB left a comment

Choose a reason for hiding this comment

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

Nice and clean work, should hopefully be okay :D one change about a breaking change needed.

@@ -97,8 +97,55 @@ class SbbToggleElement extends LitElement {
this.addEventListener?.('keydown', (e) => this._handleKeyDown(e));
}

/** @internal */
public updatePillPosition(resizing: boolean): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

to avoid a breaking change, we should keep the method and mark it deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even though it was marked as internal?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think yes, @kyubisation your opinion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diff-available pr: lead review required A lead review is required for this pull request pr: peer review required A peer review is required for this pull request pr: visual review required preview-available target: 2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

story(sbb-toggle): implement native form support
2 participants