Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reorder "clear all data" dialog buttons and update response handling #1620

Closed
wants to merge 3 commits into from

Conversation

ericyzhu
Copy link
Contributor

@ericyzhu ericyzhu commented Nov 15, 2024

Description

If the button order is specified as "Yes, No":

  • In English UI, it will actually be displayed as "No, Yes".
  • In Non-English UI, it will be displayed as "Yes (translated), No (translated)", but the ESC key is assigned to "Yes", which leads to the data being cleared after pressing the ESC key.

The reason is that Electron assigns the latin string "Yes" to the "Confirmation" action and "No" to the "Cancel" action. Although the display order of the buttons is reversed in the English UI, the value responded when pressing the ESC key is correct (index value of the "No" button). However, in the translated UI, the default value responded when pressing the ESC key is 0 (if the correct value is not assigned to cancelId).

Therefore, explicitly assign a value to cancelId.

tested only on macOS

image

PR Type

  • Feature
  • Bugfix
  • Hotfix
  • Other (please describe):

Changelog

  • I have updated the changelog/next.md with my changes.

@follow-reviewer-bot
Copy link

Thank you for your contribution. We will review it promptly.

Copy link

vercel bot commented Nov 15, 2024

@ericyzhu is attempting to deploy a commit to the RSS3 Team on Vercel.

A member of the Team first needs to authorize it.

@follow-reviewer-bot
Copy link

Suggested PR Title:

fix: reorder dialog buttons and update response handling

Change Summary:
Reordered buttons and adjusted response handling in clearAllDataAndConfirm.

Code Review:

  • File: apps/main/src/lib/cleaner.ts
    • Lines: 28-30
      • Issue: The order of the buttons has been changed so that "No" appears before "Yes", which is contrary to common UX patterns where the affirming option (e.g., "Yes") typically appears first. This might lead to user confusion or accidental confirmations. If this change is intentional, please ensure this pattern is consistent throughout the application and justify this UX decision.
    • Line: 31
      • Issue: The condition within the if statement has been updated from result.response === 1 to result.response === 0. Make sure that the logic correctly reflects the indices of the buttons after the order change. Ensure the response handling aligns with the new button order where "No" should correspond to response = 0 and "Yes" to response = 1.
    • General
      • Issue: After logical changes like reordering array elements and updating respective condition checks, it is crucial to update the associated tests to reflect these changes and add new tests if possible to confirm this behavior.

In conclusion, please address the button order concerning UX best practices, verify the logic for result.response, and ensure thorough testing.

@ericyzhu ericyzhu changed the title fix: order of buttons for "clear all data" dialog fix: reorder "clear all data" dialog buttons and update response handling Nov 15, 2024
@ericyzhu ericyzhu marked this pull request as draft November 16, 2024 05:08
@ericyzhu ericyzhu closed this Nov 16, 2024
@ericyzhu ericyzhu deleted the fix/clear-all-data-buttons branch November 16, 2024 05:23
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.

1 participant