Skip to content

OBLS-822 Disable DataWedge keystroke output for barcode inputs - #437

Open
jmiranda wants to merge 1 commit into
developfrom
OBLS-822-disable-keystroke-for-scanner-input
Open

OBLS-822 Disable DataWedge keystroke output for barcode inputs#437
jmiranda wants to merge 1 commit into
developfrom
OBLS-822-disable-keystroke-for-scanner-input

Conversation

@jmiranda

@jmiranda jmiranda commented Aug 5, 2026

Copy link
Copy Markdown
Member

Fixes the duplicate/doubled barcode value on scan (OBLS-822), a regression from the intent-based scan capture in #423.

Problem

A scan was delivered through two DataWedge channels at once:

Because keystroke typing is additive and the intent onChange replaces, the two concatenate: the scanned string is appended to itself. Confirmed on TC52 and TC53e — a scan of 4354210 submitted as 43542104354210, and ABP N60C IQ3980 as ABP N60C IQ3980ABP N60C IQ3980.

It did not reproduce on a TC20, which is the tell: the app never explicitly controlled keystroke output — configureProfileOnce() only sets the BARCODE and INTENT plugins (CONFIG_MODE: 'UPDATE'), leaving the Keystroke plugin at each device's default. So whether both channels fire (and whether they concatenate, which also depends on intent-vs-keystroke delivery timing) was left to per-device DataWedge state.

Fix

Explicitly control keystroke output so behavior is deterministic across devices. Keystroke output is a profile-wide setting (the OPENBOXES profile is associated with every activity) and can't be scoped to a single field, so it's toggled at runtime:

  • Muted while any barcode input (useScanListener consumer) is active → the scan arrives only via the intent broadcast, never also typed into the field.
  • Restored when no barcode input is active → plain inputs elsewhere can still be populated by scanning.

The active-consumer count is reference-counted so overlapping inputs (e.g. a screen input and a modal input during a dialog transition) keep it muted until the last one unmounts.

Manual keyboard entry is unaffected — keystroke_output_enabled controls only the scanner's keystroke emulation, not the soft keyboard.

Scope

  • src/hooks/constant.tsgetKeystrokeOutputConfig(enabled) (KEYSTROKE plugin config).
  • src/hooks/useScanListener.ts — reference-counted keystroke mute/restore around the existing intent subscription. No change to the subscription model otherwise.

Testing

Built locally (./gradlew assembleRelease) and sideloaded to a TC52: the doubling is gone — scans on the Inbound Sortation screen now apply the value once. Manual typing into scan fields still works.

🤖 Generated with Claude Code


Generated by Claude Code

Scans were delivered both as an intent broadcast (useScanListener) and as
keystroke output typed into the focused field, so a barcode input applied
the value twice — the scanned string was appended to itself (e.g. a scan of
"4354210" was submitted as "43542104354210"). Reproduced on TC52 and TC53e.

Keystroke output is a profile-wide DataWedge setting and cannot be scoped to
one field, so toggle it at runtime: mute it while any barcode input is active
(scans then arrive only via the intent broadcast) and restore it when none is,
so plain inputs elsewhere can still be populated by scanning. Reference counted
so overlapping inputs keep it muted until the last one unmounts. Manual keyboard
entry is unaffected — this only controls the scanner's keystroke output.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018esj4qV5h4teD7M6WfHahM
@jmiranda
jmiranda requested review from awalkowiak and olewandowski1 and a lite review from Copilot August 6, 2026 00:49
@jmiranda jmiranda changed the title OBLS-822: disable DataWedge keystroke output for barcode inputs OBLS-822 Disable DataWedge keystroke output for barcode inputs Aug 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 addresses duplicated/doubled barcode values on Zebra devices by explicitly managing DataWedge’s Keystroke output at runtime, ensuring scans are delivered only through the existing intent broadcast path while scan listeners are active.

Changes:

  • Adds a DataWedge KEYSTROKE plugin config generator (getKeystrokeOutputConfig) to toggle keystroke_output_enabled.
  • Updates useScanListener to reference-count active scan consumers and mute/unmute keystroke output when consumers mount/unmount.
  • Keeps the intent-based scan subscription model from #423, adding keystroke control around it.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/hooks/useScanListener.ts Adds reference-counted keystroke mute/restore around the existing DataWedge intent listener.
src/hooks/constant.ts Adds KEYSTROKE plugin config builder used to toggle DataWedge keystroke output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/hooks/constant.ts
Comment on lines +77 to +83
PLUGIN_CONFIG: {
PLUGIN_NAME: 'KEYSTROKE',
RESET_CONFIG: 'true',
PARAM_LIST: {
keystroke_output_enabled: enabled ? 'true' : 'false'
}
}
Comment on lines +90 to +96
return () => {
subscription.remove();
activeConsumerCount -= 1;
if (activeConsumerCount === 0) {
setKeystrokeOutput(true);
}
};
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.

2 participants