Skip to content

If we have set_focus() we need blur_focus().#5522

Merged
adhami3310 merged 3 commits into
reflex-dev:mainfrom
riebecj:main
Jul 2, 2025
Merged

If we have set_focus() we need blur_focus().#5522
adhami3310 merged 3 commits into
reflex-dev:mainfrom
riebecj:main

Conversation

@riebecj
Copy link
Copy Markdown
Contributor

@riebecj riebecj commented Jul 2, 2025

Add's blur_focus() server-side event for it's set_focus() counterpart.

Pretty self-explanatory. Updated tests to include new event.

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • New feature (non-breaking change which adds functionality)

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added a complementary blur_focus() event handler to match existing set_focus() functionality, enabling programmatic focus removal from elements.

  • Added new blur_focus() function in reflex/event.py following server-side event patterns
  • Implemented _blur_focus handler in .templates/web/utils/state.js with consistent ref resolution
  • Updated test suite in tests/units/test_event.py using pytest parameterization to cover both focus events
  • Maintains existing type hints, docstrings, and error handling patterns throughout implementation

3 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

Comment thread reflex/.templates/web/utils/state.js Outdated
Comment thread tests/units/test_event.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
adhami3310
adhami3310 previously approved these changes Jul 2, 2025
@adhami3310 adhami3310 dismissed their stale review July 2, 2025 20:07

pre-commit is failing

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 2, 2025

CodSpeed Performance Report

Merging #5522 will not alter performance

Comparing riebecj:main (98a4c1e) with main (a83ce0c)

Summary

✅ 8 untouched benchmarks

@riebecj
Copy link
Copy Markdown
Contributor Author

riebecj commented Jul 2, 2025

darglint. Gimme a sec.

@riebecj
Copy link
Copy Markdown
Contributor Author

riebecj commented Jul 2, 2025

Not sure why you're reliant on a 4yo deprecated linter...

@adhami3310
Copy link
Copy Markdown
Member

Not sure why you're reliant on a 4yo deprecated linter...

a bit of two

  1. ruff doesn't have the same rules just yet
  2. i didn't feel like converting to flake8 linter with pydoclint (using pydoclint directly isn't an option)

#4454

@adhami3310 adhami3310 merged commit 9ffa3cb into reflex-dev:main Jul 2, 2025
39 of 41 checks passed
@Alek99
Copy link
Copy Markdown
Member

Alek99 commented Jul 2, 2025

Thanks for the contribution! @riebecj

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.

3 participants