MarketSquare / MarketSquare/robotframework-browser
Add `Blur` keyword to remove focus from an element
@Snooz82 is already working on this.
Since Aug 6, 2026.
- Dominant language
- Python
- Stars
- 655
- Forks
- 147
- Avg merge
- 5h 27m
- Merged PRs (30d)
- 59
Description
## Use case
Many forms run their validation, formatting or `onchange` logic only when a field **loses** focus. After `Fill Text` the field typically still has focus, so that logic never fires and assertions on validation messages fail. The library has a `Focus` keyword but no counterpart to remove focus; today users must fall back to `Evaluate JavaScript selector (e) => e.blur()`, which bypasses Playwright's auto-waiting and strict-mode selector resolution. Playwright provides `locator.blur` for exactly this.
## Proposed keyword / arguments
`Blur selector *, timeout=None`
- `selector` — element to blur (auto-waits, strict-mode resolved, supports `->>` frame piercing like `Focus`).
- `timeout` — maximum wait time for the element; library timeout when omitted.
```robotframework
Fill Text id=email not-an-email
Blur id=email
Get Text css=.validation-error == Please enter a valid email address
Focus id=search
Blur id=search
Get Element States id=search not contains focused
```
## Playwright API
[`locator.blur`](https://playwright.dev/docs/api/class-locator#locator-blur)
## Implementation notes
- New RPC in `protobuf/playwright.proto` (selector, strict, timeout) — or reuse of the generic selector-action request shape used by `Focus`.
- One-line locator call in `node/playwright-wrapper/interaction`.
- Python keyword next to `focus` in `Browser/keywords/interaction.py`, docs, atest verifying a blur-triggered `onchange` handler fires.
## Backwards compatibility
Purely additive: a new keyword complementing the existing `Focus`; no existing behavior changes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.