Skip to content

fix(auto-query): improve icon display logic by adding selectable text element check#1087

Merged
tisfeng merged 2 commits intodevfrom
fix/auto-selection
Feb 3, 2026
Merged

fix(auto-query): improve icon display logic by adding selectable text element check#1087
tisfeng merged 2 commits intodevfrom
fix/auto-selection

Conversation

@tisfeng
Copy link
Copy Markdown
Owner

@tisfeng tisfeng commented Feb 3, 2026

This commit fixes the auto-query icon display issue by ensuring icons only appear when the focused element is a selectable text control.

Changes made:

  • Added isFocusedSelectableTextElement() method to verify if the focused element can accept text input
  • Added bundle ID allowlist for apps where focused element detection via Accessibility APIs is unreliable
  • Enhanced logging to debug icon display decisions
  • Updated auto-select text logic to skip when focused element is not selectable text

The fix prevents false positives by checking the UI element's role, selected text range, and content, ensuring the auto-query feature only triggers in appropriate contexts.

Fix #1079

…element check

This commit fixes the auto-query icon display issue by ensuring icons only appear when the focused element is a selectable text control.

Changes made:
- Added `isFocusedSelectableTextElement()` method to verify if the focused element can accept text input
- Added bundle ID allowlist for apps where focused element detection via Accessibility APIs is unreliable
- Enhanced logging to debug icon display decisions
- Updated auto-select text logic to skip when focused element is not selectable text

The fix prevents false positives by checking the UI element's role, selected text range, and content, ensuring the auto-query feature only triggers in appropriate contexts.
This refactoring enhances the focused element detection system with better organization and naming consistency.

Key improvements:
- Renamed `isTextField` to `isTextInputField` for clarity
- Centralized selectable text roles in `FocusedElementInfo.selectableTextRoles`
- Consolidated role checking logic to use `selectableTextRoles` instead of redundant definitions
- Updated method signatures to use consistent naming
- Improved code organization by moving role definitions to their logical location

The changes make the code more maintainable and reduce duplication while maintaining full backward compatibility.
@tisfeng tisfeng enabled auto-merge (squash) February 3, 2026 17:25
@tisfeng tisfeng merged commit bb70d5c into dev Feb 3, 2026
4 checks passed
@tisfeng tisfeng deleted the fix/auto-selection branch February 3, 2026 17:36
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.

打开Easydict辅助功能后,打开文件夹/双击动作均会触发系统提示音

1 participant