Skip to content

Duplicated condition in accessibility signal property change detection - lastValueOnLine never checked #303602

Closed

Description

Bug

In editorTextPropertySignalsContribution.ts, the condition on line 152 checks lastValueAtPosition !== undefined twice instead of also checking lastValueOnLine:

let lastValueAtPosition: boolean | undefined = undefined;
let lastValueOnLine: boolean | undefined = undefined;
timeouts.add(autorun(reader => {
    const newValueAtPosition = s.source.isPresentAtPosition(args.position, reader);
    const newValueOnLine = s.source.isPresentOnLine(args.position.lineNumber, reader);

    // BUG: checks lastValueAtPosition twice, should check lastValueOnLine too
    if (lastValueAtPosition !== undefined && lastValueAtPosition !== undefined) {
        if (!lastValueAtPosition && newValueAtPosition) {
            trigger(s.property, s.source, 'positional');
        }
        if (!lastValueOnLine && newValueOnLine) {
            trigger(s.property, s.source, 'line');
        }
    }

    lastValueAtPosition = newValueAtPosition;
    lastValueOnLine = newValueOnLine;
}));

The guard condition is meant to skip the initial autorun call (when both values are still undefined). Because both sides check the same variable, the guard does not properly protect against lastValueOnLine being undefined.

Fix

Change:

if (lastValueAtPosition !== undefined && lastValueAtPosition !== undefined) {

To:

if (lastValueAtPosition !== undefined && lastValueOnLine !== undefined) {

Location

  • File: src/vs/workbench/contrib/accessibilitySignals/browser/editorTextPropertySignalsContribution.ts, line 152

Activity

  1. added
    bug
    accessibility-signal
    on Mar 23, 2026
  2. removed this from the 1.114.0 milestone on Mar 30, 2026
  3. added a commit that references this issue on Nov 5, 2026
    85ee95e
  4. added
    unreleased
    insiders-released
    and removed
    unreleased
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

accessibility-signalbuginsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions