Skip to content

Select: typed interface.#96

Merged
ealmloff merged 31 commits intoDioxusLabs:mainfrom
npatsakula:main
Jul 31, 2025
Merged

Select: typed interface.#96
ealmloff merged 31 commits intoDioxusLabs:mainfrom
npatsakula:main

Conversation

@npatsakula
Copy link
Contributor

@npatsakula npatsakula commented Jul 21, 2025

#95

Plan

  • Add text_value property.
  • Re-organize code: split into files, modules.
  • Put tests under #[cfg!()] macro.
  • Write better example for full functionality.
  • Pass tests.
    • Compilation.
    • Check, clippy tests.
    • Doc comments.
    • Playwright.

Post testing

Disclaimers

Tests

I ran and maintained the tests that were in the repository. I also ran my own tests for my environment to make sure it worked.

Code structure

The component file was too big to work with adequately, so I split it into several. I also moved the tests under the сап macro, so as not to compile them in a production environment.

Language

English is not my native language, so sometimes my speech may seem edgy, even if I did not intend it that way. If you have such a feeling, I ask you to indicate this clearly, I will correct the message ASAP.

1. Multi-Language Text Search System

- Added AdaptiveKeyboard system supporting universal language matching
- Implemented 4-tier hybrid matching strategy with priority ordering
- Added support for non-Latin scripts (Cyrillic, Arabic, CJK, Indic, Greek)
- Added typo tolerance with keyboard-aware substitution costs
- Enabled mixed-script matching capabilities

Matching strategy priority:
1. Learned patterns (user corrections, highest priority)
2. Physical key distance (layout-independent proximity)
3. Unicode similarity (codepoint-based matching)
4. Phonetic groups (cross-script phonetic similarity)

2. Display vs Value Fix

- Fixed select button to show proper capitalized display text
- Enhanced separation between machine-readable values and human-readable display
- Added proper display text preservation between selections
- Implemented clean fallback to formatted value when display not provided

Before: Selects "Apple" → Button shows "apple"
After:  Selects "Apple" → Button shows "Apple"
@npatsakula npatsakula changed the title DRAFT: Select: typed interface. Select: typed interface. Jul 27, 2025
@npatsakula npatsakula marked this pull request as ready for review July 27, 2025 16:01
@github-actions
Copy link

@npatsakula
Copy link
Contributor Author

npatsakula commented Jul 27, 2025

@ealmloff, looks like it's ready 🤔

Meme image

@ealmloff
Copy link
Member

When messing with the preview, I noticed regressions in two places that weren't tested in the playwright tests:

  1. Tabbing out of the menu when a item is focused no longer closes the menu
  2. When the menu is first opened, no items should be selected. My guess is this is caused by the selected option no longer being optional in the context?

I pushed some new tests that demonstrate the issues

Copy link
Contributor Author

@npatsakula npatsakula left a comment

Choose a reason for hiding this comment

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

@ealmloff, I fixed the bugs that you mentioned before.

@ealmloff ealmloff self-requested a review July 30, 2025 21:56
Copy link
Member

@ealmloff ealmloff left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! I pushed some changes to unify the old and new fuzzy searching system so we can support both alternate keyboard layouts and non-ascii inputs. I also swapped out the context for a boxed variant so we only need explicit types in the select and option components

@ealmloff ealmloff enabled auto-merge July 31, 2025 18:18
@ealmloff ealmloff added this pull request to the merge queue Jul 31, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 31, 2025
@ealmloff ealmloff merged commit 19a1962 into DioxusLabs:main Jul 31, 2025
10 checks passed
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.

2 participants