Skip to content

feat: add accessibility labels to torch and cancel buttons#45

Merged
alexgerardojacinto merged 4 commits into
mainfrom
feat/RMET-5194/alternate-text
Jul 3, 2026
Merged

feat: add accessibility labels to torch and cancel buttons#45
alexgerardojacinto merged 4 commits into
mainfrom
feat/RMET-5194/alternate-text

Conversation

@alexgerardojacinto

@alexgerardojacinto alexgerardojacinto commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

⚠️ This PR was done with the help of Claude

Description

The Torch and Cancel buttons are icon-only with no alternative text, so VoiceOver can't announce them. This PR adds the ability to set that alternative text.

  • Adds three optional parameters on OSBARCScanParameters that set the accessibility label read by screen readers:
    • cancelButtonAccessibilityLabel
    • torchButtonOnAccessibilityLabel (torch on)
    • torchButtonOffAccessibilityLabel (torch off)
  • The torch label is state-aware (on vs off). Applied via the iOS 13-compatible .accessibility(label:).
  • When a label is not provided (nil/empty), no accessibility label is applied — behavior is identical to before this change. The labels are therefore fully opt-in and backward compatible; the consumer (e.g. the OutSystems plugin layer) supplies them, already localized.

Context

An accessibility audit flagged that the Torch and Cancel buttons have no alternative text, so they are announced incorrectly by screen readers. This exposes the labels as inputs so consumers can provide localized alternative text.

Closes #44

Type of changes

  • Fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Refactor (cosmetic changes)
  • Breaking change (change that would cause existing functionality to not work as expected)

Platforms affected

  • Android
  • iOS
  • JavaScript

Tests

  • Validate on device with VoiceOver: provided labels are announced; with no labels the buttons behave as before (no label).
  • Tested Cordova plugin with MABS builds:
  • Tested Capacitor plugin with Capacitor sample app available in the Capacitor plugin's repo.

Screenshots (if appropriate)

N/A

Checklist

  • Pull request title follows the format `RNMT-XXXX <title>`
  • Code follows code style of this project
  • CHANGELOG.md file is correctly updated
  • Changes require an update to the documentation
    • Documentation has been updated accordingly

The torch and cancel buttons were icon-only with no alternative text,
so screen readers could not announce them.

Add default English accessibility labels and expose optional
cancelButtonAccessibilityLabel, torchButtonOnAccessibilityLabel and
torchButtonOffAccessibilityLabel scan parameters so consumers can
customize/localize them.

Closes #44
When a label is not provided (nil/empty), no accessibility label is applied,
keeping the previous behavior unchanged. The English default labels are
removed; consumers supply the (localized) labels via the scan parameters.

@OS-pedrogustavobilro OS-pedrogustavobilro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tested and it worked fine, my comments are more related to documentation and clarifications

Comment thread Sources/OSBarcodeLib/Models/OSBARCScanParameters.swift Outdated
Comment thread Sources/OSBarcodeLib/Models/OSBARCScanParameters.swift Outdated
Reword the OSBARCScanParameters doc comments: nil/empty no longer says it 'uses
the library's default' (there is no default label) — it simply sets no label.
@alexgerardojacinto alexgerardojacinto merged commit 3661cfc into main Jul 3, 2026
7 checks passed
@alexgerardojacinto alexgerardojacinto deleted the feat/RMET-5194/alternate-text branch July 3, 2026 11:48
capacitor-bot pushed a commit that referenced this pull request Jul 3, 2026
# [2.2.0](2.1.1...2.2.0) (2026-07-03)

### Bug Fixes

* use Xcode 16 instead of 26 ([#41](#41)) ([bd584f0](bd584f0))

### Features

* add accessibility labels to torch and cancel buttons ([#45](#45)) ([3661cfc](3661cfc)), closes [#44](#44)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing alternative text for Cancel and Torch buttons

2 participants