Skip to content

feat: add optional accessibility label scan parameters#124

Open
alexgerardojacinto wants to merge 5 commits into
mainfrom
feat/RMET-5194/alternate-text
Open

feat: add optional accessibility label scan parameters#124
alexgerardojacinto wants to merge 5 commits into
mainfrom
feat/RMET-5194/alternate-text

Conversation

@alexgerardojacinto

@alexgerardojacinto alexgerardojacinto commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

⚠️ This PR was done with the help of Claude

Description

Adds the ability to set the alternative text (accessibility label) read by screen readers on the scanner's Cancel and Torch buttons, forwarding it to OSBarcodeLib.

  • Three optional options added to CapacitorBarcodeScannerOptions:
    • cancelButtonAccessibilityLabel
    • torchButtonOnAccessibilityLabel
    • torchButtonOffAccessibilityLabel
  • Forwarded to the library on Android (OSBarcodePlugin reads them and passes them to OSBARCScanParameters) and iOS (OSBARCScanParameters+Decodable). README regenerated via docgen.
  • When a label is not provided, no label is set — behavior is unchanged. Fully opt-in; no effect on web.

Context

An accessibility audit flagged that the Torch and Cancel buttons have no alternative text and are announced incorrectly by screen readers. RMET-5194.

Type of changes

  • Fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Refactor (cosmetic changes)
  • Breaking change

Platforms affected

  • Android
  • iOS
  • JavaScript (TypeScript API only; no web behavior change)

Tests

  • Tested Cordova plugin with MABS builds:
  • Tested Capacitor plugin with Capacitor sample app available in the Capacitor plugin's repo.

Checklist

  • Code follows code style of this project (lint passes)
  • Using conventional commits
  • Documentation updated (README regenerated; example app usage left as a local test change, not committed)

Expose cancelButtonAccessibilityLabel, torchButtonOnAccessibilityLabel and
torchButtonOffAccessibilityLabel in CapacitorBarcodeScannerOptions and forward
them to OSBarcodeLib on Android (OSBarcodePlugin) and iOS (decoder). When
omitted, no label is set.
TEMPORARY (do not publish): use the locally-built OSBarcodeLib AAR via
implementation files() on Android and relax the iOS pod version pin so the
local pod satisfies it, for testing the feat/RMET-5194/alternate-text library
branch before release. Revert before publishing: restore the published
io.ionic.libs:ionbarcode-android dependency and the 'OSBarcodeLib', '2.0.1'
pod pin, and remove the bundled AAR.
…e [skip ci]

TEMPORARY (do not publish as a real release): vendor the locally-built
OSBarcodeLib so a dev build is self-contained and needs no published library.
- iOS (CocoaPods): podspec vendors ios/Frameworks/OSBarcodeLib.xcframework
- iOS (SwiftPM): Package.swift uses a binaryTarget for the xcframework
- Android: build.gradle keeps implementation files(libs/OSBarcodeLib-release.aar)
- package.json 'files' now ships android/libs/ and ios/Frameworks/

Revert all of this (restore the published io.ionic.libs:ionbarcode-android dep,
the OSBarcodeLib pod dependency and the remote OSBarcodeLib-iOS SwiftPM package,
and drop the bundled artifacts) before publishing a real release.
Demonstrate cancelButtonAccessibilityLabel, torchButtonOnAccessibilityLabel and
torchButtonOffAccessibilityLabel in the example app's scanBarcode call.
Remove the temporary local-library scaffolding used for dev testing and point at
the published library versions that include the accessibility feature:
- Android: io.ionic.libs:ionbarcode-android:2.1.0@aar
- iOS (CocoaPods): OSBarcodeLib 2.2.0
- iOS (SwiftPM): OSBarcodeLib-iOS from 2.2.0
The bundled AAR/xcframework and the package 'files' additions are dropped.
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.

1 participant