[yew-devel] [PATCH yew-comp 4/4] wizard: fix form progressing when pressing enter
Dominik Csapak
d.csapak at proxmox.com
Tue May 6 15:26:33 CEST 2025
commit
d5f3c95 (wizard: allow enter to be used for switching to next page)
intended the current page to be progressed with enter the same way
the next button is pressed.
The check for this was wrong though, since not only the form context
validity is relevant, also the page_lock state and previous page
validity state.
To fix this, use the WizardState's `can_progress` check we now have
instead, which is also used to enable/disable the `next` button.
Fixes: d5f3c95 (wizard: allow enter to be used for switching to next page)
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/wizard.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wizard.rs b/src/wizard.rs
index 16b1dd8..7c05ffd 100644
--- a/src/wizard.rs
+++ b/src/wizard.rs
@@ -523,9 +523,9 @@ impl Component for PwtWizard {
.class(Flex::Fill)
.form_context(form_ctx.clone())
.onsubmit(ctx.link().batch_callback({
- let form_ctx = form_ctx.clone();
+ let state = self.controller.clone();
move |_| {
- if !form_ctx.read().is_valid() {
+ if !state.read().can_progress() {
return None;
}
if let Some(page) = next_page.clone() {
--
2.39.5
More information about the yew-devel
mailing list