Skip to content

fix(ui5-slider): improve labels structure and placement #11848

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

Merged
merged 5 commits into from
Jul 7, 2025

Conversation

Vonahz
Copy link
Contributor

@Vonahz Vonahz commented Jul 3, 2025

fixes: #9908

@ndeshev ndeshev self-requested a review July 4, 2025 10:33
Copy link
Contributor

@ndeshev ndeshev left a comment

Choose a reason for hiding this comment

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

add a pull request message (fixes: #123)
change the title to something more 'understandable' - 'improve labels structure and placement' or something like that :))

@ndeshev ndeshev requested a review from Copilot July 4, 2025 17:12
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an overflow issue in the UI5 slider by refactoring how label containers are sized and rendered.

  • Converted inline width calculations into CSS-based flex layout and pseudo-elements
  • Replaced style-based label rendering in the template with data-counter attributes and CSS
  • Simplified label-overlap detection logic in the base class and removed now-unnecessary style props

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/main/src/themes/SliderBase.css Adjusted tickmark border units; refactored label container to use flex and pseudo-elements
packages/main/src/SliderBaseTemplate.tsx Removed inline label styles and switched to data-counter attributes
packages/main/src/SliderBase.ts Removed abstract style props; added rem-based overlap calculation with new logic
packages/main/src/Slider.ts Removed now-unused inline label style properties
packages/main/src/RangeSlider.ts Removed now-unused inline label style properties
Comments suppressed due to low confidence (4)

packages/main/src/SliderBaseTemplate.tsx:44

  • [nitpick] The data-counter attribute may not clearly convey its purpose. Consider renaming it to something like data-label or data-value to improve readability.
									<li data-counter={l}></li>

packages/main/src/SliderBase.ts:412

  • New overlap-detection logic should be covered by unit tests to ensure correct behavior when labels do and do not overlap.
		this._labelsOverlapping = labelItemsParentWidth < labelItemsSumWidth;

packages/main/src/themes/SliderBase.css:207

  • Applying width: 100% to .ui5-slider-handle will stretch the handle across the full track. These layout rules (width, display, justify-content) should be moved to the label container (.ui5-slider-labels) instead of the handle.
    width: 100%;

packages/main/src/themes/SliderBase.css:206

  • [nitpick] Indentation of the new CSS properties uses 4 spaces, while existing rules use 2 spaces. Align to the project's style guide for consistency.
    height: 1rem;

@Vonahz Vonahz changed the title fix(ui5-slider): slider label container width creates overflow fix(ui5-slider): improve labels structure and placement Jul 7, 2025
@Vonahz Vonahz merged commit 69627b4 into main Jul 7, 2025
40 of 44 checks passed
@Vonahz Vonahz deleted the slider-label-position branch July 7, 2025 11:12
@ui5-webcomponents-bot
Copy link
Collaborator

🎉 This PR is included in version v2.13.0-rc.0 🎉

The release is available on v2.13.0-rc.0

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slider labels cause a horizontal scrollbar
3 participants