invalid-range-values
Mobile validation
UISlider's maximumValue must be greater than its minimumValue.The minimumValue of a UISlider must be lower than its maximumValue. When the range is invalid, the slider looks and behaves as if it were disabled, but VoiceOver doesn't announce it as disabled, may announce an invalid value, and cannot adjust it.
Don't try to disable a slider by setting an invalid range. If the slider needs to be disabled, set its isEnabled property to false, so its state is exposed to assistive technologies.
Note: This validation applies to iOS UISlider only, including a UISlider wrapped for SwiftUI with UIViewRepresentable. SwiftUI's Slider takes a closed range, which cannot have a lower bound greater than its upper bound, so there are no SwiftUI, Android, or cross-platform examples.
Pass Patterns
iOS
UIKit
The slider's minimumValue is lower than its maximumValue.
let volumeSlider = UISlider()
volumeSlider.accessibilityLabel = "Volume"
volumeSlider.minimumValue = 0
volumeSlider.maximumValue = 100
volumeSlider.value = 50A slider that must be unavailable keeps a valid range and is disabled with isEnabled.
let volumeSlider = UISlider()
volumeSlider.accessibilityLabel = "Volume"
volumeSlider.minimumValue = 0
volumeSlider.maximumValue = 100
volumeSlider.isEnabled = falseFail Patterns
iOS
UIKit
The slider's minimumValue is greater than its maximumValue.
let volumeSlider = UISlider()
volumeSlider.accessibilityLabel = "Volume"
volumeSlider.minimumValue = 100
volumeSlider.maximumValue = 0The slider's minimumValue and maximumValue are equal, so there is no range to adjust. Rather use .isEnabled = false
let volumeSlider = UISlider()
volumeSlider.accessibilityLabel = "Volume"
volumeSlider.minimumValue = 0
volumeSlider.maximumValue = 0Try It Yourself
Using a screen reader
New to screen reader testing, or need a refresher?
Review this article first: Practical guides for using screen readers
- Turn on VoiceOver.
- Swipe right or left to move to the slider.
- Swipe up and down to adjust the slider's value.
Expected results: VoiceOver announces a valid value, swiping up increases it, and swiping down decreases it. If the slider is unavailable, VoiceOver announces it as dimmed.
Actual results: The value does not change, VoiceOver announces an invalid value, or the slider behaves as disabled without being announced as dimmed.
Using developer tools
- In Xcode, open Xcode > Open Developer Tool > Accessibility Inspector, select the simulator or device, and point at the slider. Check its Value, and try its increment and decrement actions.
Expected results: The Value is valid and changes when you use the increment and decrement actions.
Actual results: The Value is invalid, or does not change.
FAQ
How does this issue relate to 4.1.2 Name, role, value?
SC 4.1.2 requires the value of every user interface component to be programmatically determinable, and values that users can set to be programmatically settable. With an invalid range, the slider's value cannot be reliably determined or set by assistive technologies, and a slider that is disabled this way does not expose its disabled state.
Why is this issue marked as Critical?
With an invalid range, nobody can adjust the slider, and assistive technology users are not told why. They may keep trying to change a value that cannot change, and cannot complete the task that depends on it, so it is rated critical.
Standards and Regulations
| Standard | Success Criterion | Reference |
|---|---|---|
| WCAG 2.2 | 4.1.2 Name, Role, Value (A) | For all user interface components, the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to assistive technologies. |
| EN 301 549 | 11.4.1.2 Name, Role, Value | Same as the WCAG text. |
| Section 508 | 1194.21(d) | Sufficient information about a user interface element including the identity, operation and state of the element shall be available to assistive technology. When an image represents a program element, the information conveyed by the image must also be available in text. |