Make select just to be select - Remove dropdown and simply style#98
Make select just to be select - Remove dropdown and simply style#98LittleLittleCloud merged 6 commits intomainfrom
Conversation
LittleLittleCloud
commented
Nov 6, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Select component to simplify its UI by removing the dropdown toggle behavior and always displaying all options. The changes convert it from a collapsible dropdown to an always-visible list-style selector.
- Removed the dropdown toggle mechanism and related UI (input box with Panel, placeholder/value display logic, empty state)
- Simplified the rendering to always show all options with highlight indicator
- Updated the gallery example to use two-way binding (
@bind-Value) instead of one-wayValueparameter
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/RazorConsole.Core/Components/Select.razor | Refactored to always display all options in a list format, removed dropdown toggle functionality, simplified styling logic, removed unused parameters (Placeholder, BorderStyle, etc.) |
| src/RazorConsole.Gallery/Components/SelectGallery.razor | Updated example to use @bind-Value binding and initialized Select field with default value |
Comments suppressed due to low confidence (3)
src/RazorConsole.Core/Components/Select.razor:177
- The
_isOpenchecks in keyboard handling are now obsolete since the options are always visible. These conditions should be updated to reflect the new always-visible behavior.
if (IsCommitKey(key) && _isOpen && _highlightedValue is not null)
{
await SelectOptionAsync(_highlightedValue).ConfigureAwait(false);
return;
}
if (IsCancelKey(key) && _isOpen)
{
_isOpen = false;
_highlightedValue = _selectedValue;
await InvokeAsync(StateHasChanged).ConfigureAwait(false);
return;
}
src/RazorConsole.Core/Components/Select.razor:294
- The
EnsureOpenmethod is now obsolete since the component no longer has open/closed states. This method should be refactored or removed.
private bool EnsureOpen()
{
if (_isOpen)
{
EnsureHighlightedValue();
return false;
}
_isOpen = true;
EnsureHighlightedValue();
return true;
}
src/RazorConsole.Core/Components/Select.razor:359
- The
_isOpencheck inSyncHighlightedValueis now obsolete. Since options are always visible, this method should be simplified.
private void SyncHighlightedValue()
{
if (_isOpen)
{
EnsureHighlightedValue();
return;
}
_highlightedValue = _selectedValue;
}
| private void OnFocus() | ||
| { | ||
| _isFocused = true; | ||
| _inputBorderColor = Color.Yellow; | ||
| } |
There was a problem hiding this comment.
The assignment to _inputBorderColor is now unused since the field is no longer rendered. Remove this line.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (5)
src/RazorConsole.Core/Components/Select.razor:94
- The field
_isOpenis referenced but was removed in the diff (previously at line 32). This will cause compilation errors. Since the component no longer has dropdown toggle behavior, this method should either be removed or refactored to not use_isOpen.
if (_isOpen)
{
EnsureHighlightedValue();
_isOpen = false;
}
else
{
_isOpen = true;
}
src/RazorConsole.Core/Components/Select.razor:160
- The field
_isOpenis referenced but was removed in the diff. This condition check will cause a compilation error.
if (IsCommitKey(key) && _isOpen && _highlightedValue is not null)
src/RazorConsole.Core/Components/Select.razor:168
- The field
_isOpenis referenced but was removed in the diff. Both the condition and assignment will cause compilation errors.
if (IsCancelKey(key) && _isOpen)
{
_isOpen = false;
src/RazorConsole.Core/Components/Select.razor:284
- The field
_isOpenis referenced but was removed in the diff. TheEnsureOpen()method will fail to compile.
if (_isOpen)
{
EnsureHighlightedValue();
return false;
}
_isOpen = true;
src/RazorConsole.Core/Components/Select.razor:351
- The field
_isOpenis referenced but was removed in the diff. TheSyncHighlightedValue()method will fail to compile.
if (_isOpen)
{
EnsureHighlightedValue();
return;
}
|
@copilot fix test error |
|
@LittleLittleCloud I've opened a new pull request, #99, to work on those changes. Once the pull request is ready, I'll request review from you. |