Skip to content

New: Improve styles when prefixes / suffixes are present (fixes #591)#592

Merged
oliverfoster merged 6 commits into
masterfrom
issue/591
Apr 13, 2026
Merged

New: Improve styles when prefixes / suffixes are present (fixes #591)#592
oliverfoster merged 6 commits into
masterfrom
issue/591

Conversation

@swashbuck
Copy link
Copy Markdown
Contributor

@swashbuck swashbuck commented Apr 1, 2026

Fixes #591

Depends on adaptlearning/adapt-contrib-slider#234

New

  • When .has-scale-step-prefix or .has-scale-step-suffix is present, scale labels switch to a lozenge (pill) shape
  • The default circle style is unchanged. Only sliders with a configured prefix or suffix are affected.
Slider

Known issues

  1. When scaleStepPrefix or scaleStepSuffix are configured, the first and last scale labels may extend beyond the edges of the slider widget, as the lozenge is wider than the original circle. This is expected since the amount of additional space needed depends on the length of the prefix/suffix strings.
Screenshot 2026-04-01 at 2 16 17 PM

The recommended fix is to add horizontal padding or margin to .slider__widget (or scope it to .slider__widget.has-scale-step-prefix / .has-scale-step-suffix) in a course-specific or custom theme override.

// Adjust slider widget when affixes are present
.slider__widget.has-scale-step-suffix,
.slider__widget.has-scale-step-prefix {
  @media (min-width: @slider-affix-breakpoint) {
    margin: 0 1rem;
  }
}

Testing

  1. Configure a slider with scaleStepPrefix (e.g. $) and/or scaleStepSuffix (e.g. days)
  2. Verify scale labels render as lozenges (pill shape) with the prefix/suffix content fitting inside
  3. Verify a slider without prefix or suffix still renders labels as circles
  4. Verify the selected value indicator and correct answer indicator also use the lozenge shape when prefix/suffix are set
  5. Test in both LTR and RTL layouts

Posted via collaboration with Claude Code

@swashbuck swashbuck self-assigned this Apr 1, 2026
@swashbuck swashbuck moved this from New to Assigned in adapt_framework: The TODO Board Apr 1, 2026
@swashbuck swashbuck moved this from Assigned to Needs Reviewing in adapt_framework: The TODO Board Apr 1, 2026
@swashbuck swashbuck changed the title New: Use lozenge style for slider labels when scaleStepPrefix/scaleStepSuffix are set (fixes #591) New: Improve styles when prefixes / suffixes are present (fixes #591) Apr 1, 2026
Copy link
Copy Markdown
Contributor

@kirsty-hames kirsty-hames left a comment

Choose a reason for hiding this comment

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

Works as expected thanks 👍

For smaller screen widths, is it worth including a media query to hide the suffix/prefix by default as I imagine most use cases will overlap. For example:

.slider__scale-step-prefix,
.slider__scale-step-suffix {
  @media (max-width: @device-width-medium) {
    display: none;
  }
}

@swashbuck
Copy link
Copy Markdown
Contributor Author

swashbuck commented Apr 2, 2026

For smaller screen widths, is it worth including a media query to hide the suffix/prefix by default as I imagine most use cases will overlap.

@kirsty-hames Yep, this makes sense as there would often not be enough available space on mobile.

Mobile view

I've added a new variable called @slider-affix-breakpoint to control when the affixes are displayed. This also controls when to use the lozenge styles vs the circles. 86143b5

@kirsty-hames
Copy link
Copy Markdown
Contributor

I've added a new variable called @slider-affix-breakpoint to control when the affixes are displayed. This also controls when to use the lozenge styles vs the circles. 86143b5

Works as expected thanks @swashbuck 👍

@oliverfoster oliverfoster merged commit bc07d31 into master Apr 13, 2026
@oliverfoster oliverfoster deleted the issue/591 branch April 13, 2026 09:11
@github-project-automation github-project-automation Bot moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Board Apr 13, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 13, 2026
# [9.34.0](v9.33.0...v9.34.0) (2026-04-13)

### New

* Improve styles when prefixes / suffixes are present (fixes #591) (#592) ([bc07d31](bc07d31)), closes [#591](#591) [#592](#592)
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 9.34.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

Status: Recently Released

Development

Successfully merging this pull request may close these issues.

Improve styles when prefixes / suffixes are present

3 participants