Fix: Implicit Submit Bug & UX Enhancements In Word App

by Viktoria Ivanova 55 views

Hey guys! Let's dive into this bug report that aims to enhance the user experience of our word discussion app, focusing on preventing accidental submissions and improving button clarity. We'll break down the issue, explore the root cause, propose a fix, and define acceptance criteria. This article will help you understand the problem, the solution, and how it improves the overall app experience.

Summary

The main problem we're tackling here is an implicit submit/new row creation that occurs when the first tile is set to green. This unintended behavior disrupts the user flow. Imagine you're carefully crafting your word strategy, and suddenly, changing a tile color triggers an unexpected submission! Not cool, right? We also need to address the Confirm button, which should only be enabled when the current row has a complete word. Finally, we'll be adding tooltips to buttons that are currently lacking them, providing helpful context and guidance to the user. These improvements make the app more intuitive and user-friendly.

Steps to Reproduce

To understand the bug better, let's walk through the steps to reproduce it:

  1. Open the app. Seems simple enough, right?
  2. Enter a word. Go ahead and type in your best guess.
  3. Toggle the first tile to green. This is where the magic (or rather, the bug) happens.
  4. Observe: The app unexpectedly runs recommendations and may add a new row, especially if the current row is complete. This is definitely not what we want!

This unintended behavior can lead to frustration and a less-than-ideal user experience. We want users to have full control over their submissions, not be surprised by automatic actions.

Expected Behavior

So, what should happen instead? Here's what we expect:

  • Toggling any tile’s color, including changing the first tile to green, should only update the color. No implicit submissions or new row creation should occur.
  • The Confirm button should be disabled unless the current row contains a complete word. This prevents accidental submissions of incomplete words.
  • All buttons should have helpful tooltips, providing users with clear guidance on their function. Tooltips are like little helpers that explain what each button does, making the app easier to navigate.

These expected behaviors ensure a more controlled and intuitive user experience. Users can focus on their word strategy without worrying about unintended actions.

Root Cause Analysis

Let's get a little technical and dig into the root cause of this bug. The culprit lies in the controller logic, specifically how it handles color changes:

  • In lib/state/solver_state.dart, the setTileFeedback(...) method calls requestRecommendations() when colIndex == 0 && nextColor == TileFeedback.green.
  • Similarly, the setFeedbackAtSelection(...) method calls requestRecommendations() when idx == 0 && nextColor == TileFeedback.green.

This means that when the first tile is turned green, the app mistakenly triggers a recompute. If the current row is complete, this recompute consumes the row and appends a new one. It's like the app is jumping the gun and submitting your word before you're ready!

Proposed Fix

Now for the good news – we have a solution! Here's our proposed fix to address the bug and improve the user experience:

  • Remove the implicit recompute in both setTileFeedback(...) and setFeedbackAtSelection(...) methods. Color changes should not trigger submissions. This is the core of the fix, preventing the unwanted automatic behavior.
  • Gate the Confirm button: Disable it unless the current row is complete (i.e., contains non-empty letters). This adds a layer of control and prevents accidental submissions. We'll keep the existing validation on press to ensure the submitted word is valid.
  • Add tooltips to buttons that currently lack them, including Confirm, New, Submit, Green/Yellow color pickers, and Clear Prefix. Tooltips provide valuable context and help users understand the functionality of each button.

These changes will ensure a more predictable and user-friendly experience. Users will have full control over their submissions and clear guidance on how to use the app.

Acceptance Criteria

To ensure our fix is effective, we need to define clear acceptance criteria. This is essentially a checklist to verify that the bug is resolved and the improvements are implemented correctly:

  • Changing the first tile to green should never trigger a submit or row creation. This is the primary goal of the fix.
  • The Confirm button should be disabled until the row is complete. This prevents accidental submissions.
  • Tooltips should be present on the Confirm, New, Submit, color pickers, and Clear Prefix buttons. This enhances usability and provides clear guidance.
  • The existing manual Submit flow should remain unchanged. We don't want to break anything that's already working well.

By meeting these criteria, we can confidently say that the bug is fixed and the user experience is significantly improved.

Important Note

It's important to note that prefix deduction should still occur on explicit submit. We're not changing the core submission behavior, just preventing the accidental automatic submissions triggered by color changes.

In conclusion, this bug fix will greatly enhance the usability of the app by preventing unexpected submissions and providing clear guidance to users. By removing the implicit recompute, gating the Confirm button, and adding tooltips, we're creating a more intuitive and enjoyable experience for everyone. Keep up the great work, team!