Skip to content

feat: add Blur keyword - #5422

Merged
aaltat merged 2 commits into
MarketSquare:mainfrom
aaltat:add-blur-keyword
Nov 1, 2026
Merged

aaltat merged 2 commits into
MarketSquare:mainfrom
aaltat:add-blur-keyword

Conversation

@aaltat

@aaltat aaltat commented Nov 1, 2026

Copy link
Copy Markdown
Member

Summary

Adds Blur selector, the counterpart of Focus, for pages that run validation or formatting only after a field loses focus.

Blur (Browser/keywords/interaction.py)
  presenter_mode(selector)
  rpc Blur(Request.ElementSelector)
    interaction.blur
      findLocator(selector, strict)
      locator.blur()
Fill Text    id=email    not-an-email
Blur    id=email
Get Text    css=.validation-error    ==    Please enter a valid email address
  • Why a keyword: the need is generally useful, though it comes up rarely. It adds no new capability. Contrary to the issue, Evaluate JavaScript selector (e) => e.blur() already goes through findLocator with strict mode, so the case for Blur is that users should not need JavaScript for this.
  • No timeout argument: same as Focus; element interaction keywords use the library timeout.
  • Required selector: Blur css=:focus covers the focused element in the main frame, outside shadow DOM; the docstring lists the limits.
  • Element without focus: the keyword passes and fires no blur event, as native blur() does. This is documented in the docstring.

Fixes #5102

Evidence

  • Before: Blur does not exist.
    After: inv atest --suite focus: 8 tests, 8 passed. Six are new, in atest/test/02_Content_Keywords/focus.robot:
Blur Removes Focus From Element              Focus, Blur            -> contains defocused
Blur Fires Blur Event                        Focus, Blur            -> event log has blur
Blur On Element Without Focus Does Nothing   Blur                   -> event log has no blur
Blur On Element Without Focus Keeps Focus On Other Element  Focus other, Blur -> other stays focused
Blur Element Which Has Focus                 Focus, Blur css=:focus -> contains defocused
Blur With Strict                             Blur //input           -> strict mode violation; non-strict blurs first match

inv utest (1542 passed, 2 skipped), inv utest-node (328 passed) and inv lint also pass locally. The full acceptance suite was not run locally.

Merge Danger

Door: two-way until released, then one-way

After release, removing or renaming the keyword needs a deprecation cycle and breaks user translations.

Blast Radius: additive

Existing keywords do not change. Each translation gains one untranslated keyword.

🤖 Generated with Claude Code

aaltat and others added 2 commits November 1, 2026 13:49
Blur removes focus from an element, for pages that run validation or
formatting only after a field loses focus.

Fixes MarketSquare#5102

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@aaltat
aaltat merged commit 596663d into MarketSquare:main Nov 1, 2026
60 of 61 checks passed
@aaltat
aaltat deleted the add-blur-keyword branch November 1, 2026 13:00
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.

Add Blur keyword to remove focus from an element

1 participant