Skip to content

Commit 53f51a8

Browse files
committed
cherry-pick(#33638): chore: clear highlight when performing action
1 parent 2a00ca8 commit 53f51a8

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

packages/playwright-core/src/server/injected/recorder/recorder.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,10 @@ class RecordActionTool implements RecorderTool {
492492
return;
493493
const result = activeElement ? this._recorder.injectedScript.generateSelector(activeElement, { testIdAttributeName: this._recorder.state.testIdAttributeName }) : null;
494494
this._activeModel = result && result.selector ? result : null;
495-
if (userGesture)
495+
if (userGesture) {
496496
this._hoveredElement = activeElement as HTMLElement | null;
497-
this._updateModelForHoveredElement();
497+
this._updateModelForHoveredElement();
498+
}
498499
}
499500

500501
private _shouldIgnoreMouseEvent(event: MouseEvent): boolean {
@@ -589,6 +590,8 @@ class RecordActionTool implements RecorderTool {
589590
}
590591

591592
private _updateModelForHoveredElement() {
593+
if (this._performingActions.size)
594+
return;
592595
if (!this._hoveredElement || !this._hoveredElement.isConnected) {
593596
this._hoveredModel = null;
594597
this._hoveredElement = null;

tests/library/inspector/cli-codegen-2.spec.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,6 @@ await page1.GotoAsync("about:blank?foo");`);
402402
await expect.poll(() => messages).toEqual(['mousedown', 'mouseup', 'click']);
403403
});
404404

405-
test('should update hover model on action', async ({ openRecorder }) => {
406-
const { page, recorder } = await openRecorder();
407-
408-
await recorder.setContentAndWait(`<input id="checkbox" type="checkbox" name="accept" onchange="checkbox.name='updated'"></input>`);
409-
const [models] = await Promise.all([
410-
recorder.waitForActionPerformed(),
411-
page.click('input')
412-
]);
413-
expect(models.hovered).toBe('#checkbox');
414-
});
415-
416405
test('should reset hover model on action when element detaches', async ({ openRecorder }) => {
417406
const { page, recorder } = await openRecorder();
418407

0 commit comments

Comments
 (0)