Skip to content

Conversation

@alizedebray
Copy link
Contributor

@alizedebray alizedebray commented Oct 13, 2025

📄 Description

This PR add a slider component to our raw components.

🚀 Demo

https://preview-6435--swisspost-design-system-next.netlify.app/?path=/docs/d6bc3b88-050b-4ed7-af0d-c01d22a2605a--docs


🔮 Design review

  • Design review done
  • No design review needed

📝 Checklist

  • ✅ My code follows the style guidelines of this project
  • 🛠️ I have performed a self-review of my own code
  • 📄 I have made corresponding changes to the documentation
  • ⚠️ My changes generate no new warnings or errors
  • 🧪 I have added tests that prove my fix is effective or that my feature works
  • ✔️ New and existing unit tests pass locally with my changes

@alizedebray alizedebray requested review from a team as code owners October 13, 2025 13:18
@alizedebray alizedebray requested a review from leagrdv October 13, 2025 13:18
@alizedebray alizedebray linked an issue Oct 13, 2025 that may be closed by this pull request
5 tasks
@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2025

⚠️ No Changeset found

Latest commit: bd09654

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Oct 13, 2025

Related Previews

@alizedebray alizedebray changed the base branch from main to slider-component-utils October 13, 2025 13:22
@alizedebray alizedebray added the 🚂 PR train PR which follows another one. label Oct 13, 2025
@alizedebray alizedebray changed the base branch from slider-component-utils to main October 13, 2025 13:24
@alizedebray alizedebray force-pushed the 5854-web-component-func-slider branch from fe09fda to a6960b5 Compare October 13, 2025 13:30
@alizedebray alizedebray changed the base branch from main to slider-component-utils October 13, 2025 13:30
@alizedebray alizedebray force-pushed the 5854-web-component-func-slider branch from a6960b5 to e9fbcc3 Compare October 13, 2025 13:31
@alizedebray alizedebray force-pushed the 5854-web-component-func-slider branch from e9fbcc3 to bd09654 Compare October 13, 2025 13:41
@sonarqubecloud
Copy link

Copy link
Contributor

@leagrdv leagrdv left a comment

Choose a reason for hiding this comment

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

I saw in the specs of the ticket mentions of ticks within a datalist. Do you plan on adding the examples and CSS in another PR?

}

constructor(node: Node | EventTarget, host: HTMLElement, orientation: Orientation) {
if (!isThumb(node)) throw Error('An active thumb must be an HTML element with a slider role.');
Copy link
Contributor

Choose a reason for hiding this comment

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

The constructor is only called onPointerDown of the div with the role="slider", therefore isThumb(node) should always be true so I'm not sure it's worth checking here.

@Watch('value')
validateValue() {
if (this.range) {
checkEmptyOrArrayOf(this, 'value', 'number');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a more precise check that there is 2 elements within the array?

* The greatest value in the range of permitted values.
*/
@Prop() max = 100;
@Watch('max')
Copy link
Contributor

Choose a reason for hiding this comment

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

This part of the specs is not verified:
min, max, and step must be numbers. min must be lower than max. step must be lower than max - min.
Same goes for the value: it is not checked whether the defined value is between the min and max

The result is a broken slider if I try to set wrong data but I get no errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

If I try to fill in some fields to test it, it breaks the slider in the demo.
I think defining default args for the different values should fix it.
https://github.com/user-attachments/assets/ff0f5525-5996-4362-93ac-64e1ea7729ef

@leagrdv
Copy link
Contributor

leagrdv commented Oct 16, 2025

Also, last bug I found. Sometimes I can't move the slider and I get the 🚫 icon that appears. It seems to be random and happens pretty rarely though and I always manage to slide it again when I select the slider again.
https://github.com/user-attachments/assets/9f4c4d0d-5e8f-4938-962e-cc2d4ef2a550

@alizedebray
Copy link
Contributor Author

I saw in the specs of the ticket mentions of ticks within a datalist. Do you plan on adding the examples and CSS in another PR?

I tried the datalist and it might not be the right approach in the end. I'll split the ticket and create another one for this specific feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚂 PR train PR which follows another one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web component func] Slider

4 participants