Skip to content

[A11y] Add Save button to Report settings single-select pages (Write capability, Notification preference, Visibility)#94557

Open
MelvinBot wants to merge 12 commits into
mainfrom
claude-a11y-report-settings-save
Open

[A11y] Add Save button to Report settings single-select pages (Write capability, Notification preference, Visibility)#94557
MelvinBot wants to merge 12 commits into
mainfrom
claude-a11y-report-settings-save

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

This is PR 1 of the batched rollout plan that extends the WCAG 3.2.2 ("On Input") fix from #92749 to the remaining single-select pages. It covers the three Report settings pages, grouped together because they live in the same directory and share the identical SelectionList + SingleSelectListItem pattern.

Before this change each page persisted the change and navigated away the instant a row was selected, which is the "change of context on input" that WCAG 3.2.2 prohibits — especially disruptive for screen-reader users. The fix mirrors #92749: the selection is held in local draft state (the page stays open, the checkmark moves), and the change is only persisted + the page closed when the user taps a Save button added via confirmButtonOptions.

Pages fixed:

  • DynamicWriteCapabilityPageonSelectRow now updates draft selectedWriteCapability; Save calls updateWriteCapability + goBack.
  • DynamicNotificationPreferencePageonSelectRow now updates draft selectedNotificationPreference; Save calls updateNotificationPreference + goBack.
  • DynamicVisibilityPage ⚠️ — same draft + Save pattern, but the Public confirmation modal is preserved: selecting Public just moves the checkmark, and the existing "Are you sure?" modal is now gated on Save (if the user cancels the modal, nothing is persisted and the page stays open).

No SelectionList component changes; behavior is identical on web and native; optimistic/offline behavior is unchanged.

Fixed Issues

$ #74834
PROPOSAL: #74834 (comment)

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.

  1. Open a report → SettingsNotify me about new messages. Select a different option and verify the page does not close automatically; the checkmark moves to the selection. Tap Save and verify the preference is saved and the page closes. Re-open, change a selection, tap the back button without Save, and verify the original value is retained.
  2. Repeat for Who can post (write capability) on a report where you can edit it.
  3. For a room you own, open SettingsVisibility. Select Private/Restricted and verify the page stays open until Save. Select Public, tap Save, and verify the "Are you sure?" confirmation modal appears; confirm → visibility saves and page closes; cancel → nothing saved and page stays open.
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests — selecting an option and tapping Save should optimistically apply the change while offline.

QA Steps

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
      • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videosundefined

…button

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team June 25, 2026 08:31
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...tings/Report/DynamicNotificationPreferencePage.tsx 0.00% <0.00%> (ø)
...ges/settings/Report/DynamicWriteCapabilityPage.tsx 0.00% <0.00%> (ø)
...rc/pages/settings/Report/DynamicVisibilityPage.tsx 0.00% <0.00%> (ø)
... and 8 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I analyzed the failing checks. There's no code failure to fix — every code/CI check passes (typecheck, all 8 test jobs, ESLint, Prettier, Bun tests, Storybook, all builds, React Compiler, knip, spellcheck, codecov).

The single red check is PR Author Checklist / checklist, which failed with:

You completed 0 out of 41 checklist items with 41 unfinished items

This is the manual author checklist in the PR description — it can only be cleared by you checking the boxes (it's intentionally human-only, so I won't fill it out on your behalf). Once you complete the checklist, that check will pass and the PR will be green.

When I first looked, several test jobs and typecheck were still running; they have all since finished successfully, so no commit is needed.

@truph01

truph01 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Mark this PR as ready for review

@MelvinBot
MelvinBot marked this pull request as ready for review June 25, 2026 09:12
@MelvinBot
MelvinBot requested a review from a team as a code owner June 25, 2026 09:12
@melvin-bot
melvin-bot Bot requested review from flaviadefaria and truph01 and removed request for a team June 25, 2026 09:12
@melvin-bot

melvin-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

@truph01 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team June 25, 2026 09:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d85eb1a072

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/pages/settings/Report/DynamicNotificationPreferencePage.tsx Outdated
Comment thread src/pages/settings/Report/DynamicNotificationPreferencePage.tsx Outdated
Comment thread src/pages/settings/Report/DynamicNotificationPreferencePage.tsx Outdated
Comment thread src/pages/settings/Report/DynamicWriteCapabilityPage.tsx Outdated
Comment thread src/pages/settings/Report/DynamicWriteCapabilityPage.tsx Outdated
Comment thread src/pages/settings/Report/DynamicVisibilityPage.tsx Outdated
Comment thread src/pages/settings/Report/DynamicVisibilityPage.tsx Outdated
Comment thread src/pages/settings/Report/DynamicVisibilityPage.tsx Outdated
@truph01

truph01 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Check and resolve all comments above

…rop redundant React Compiler memoization

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner June 25, 2026 09:39
@melvin-bot
melvin-bot Bot requested review from lakchote and removed request for a team June 25, 2026 09:39
@melvin-bot

melvin-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

@lakchote Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const isMoneyRequest = isMoneyRequestReport(report);
const currentNotificationPreference = getReportNotificationPreference(report);
// Keep the draft undefined until the user picks a row so we always fall back to the live preference.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Put an empty line before the comment unless it’s on the first line of a block.

Suggested change
// Keep the draft undefined until the user picks a row so we always fall back to the live preference.
// Keep the draft undefined until the user picks a row so we always fall back to the live preference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 0f72407 — added the blank line before the comment.

return;
}
updateRoomVisibility(report.reportID, report.visibility, newVisibility);
// Selecting Public is a sensitive change, so it still has to be confirmed before we persist it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Selecting Public is a sensitive change, so it still has to be confirmed before we persist it.
// Selecting Public is a sensitive change, so it still has to be confirmed before we persist it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 0f72407 — added the blank line before the comment.

@truph01

truph01 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Resolve the above comments

…ttings-save

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Merged latest main into this branch and pushed. No conflicts — the merge was clean.

@truph01

truph01 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c555d0b035

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


const {showConfirmModal} = useConfirmModal();

const [selectedVisibility, setSelectedVisibility] = useState<RoomVisibility | undefined>(report?.visibility);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep report-setting drafts unset until the user selects

When an Onyx update changes report.visibility after this page mounts but before the user chooses a row, selectedVisibility remains the old value; pressing Save then sends that stale value using the newly updated report.visibility as the previous value, reverting the external change. This also affects selectedWriteCapability in DynamicWriteCapabilityPage.tsx:29. Use an initially undefined draft and fall back to the live report value until the first explicit selection, as the notification-preference page does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot I think it is a valid concern. Please resolve it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed — fixed in 3f2079c. Both pages now mirror the notification-preference page: the draft stays undefined until the user picks a row, and the selected value falls back to the live report value until then. So an Onyx update to report.visibility / report.writeCapability after mount is no longer frozen out and can't be reverted on Save.

onSelectRow now sets the draft, and initiallyFocusedItemKey still points at the live value so the correct row is focused on open.

ListItem={SingleSelectListItem}
onSelectRow={(option) => updateNotificationPreferenceForReportAction(option.value)}
onSelectRow={(option) => setDraftNotificationPreference(option.value)}
confirmButtonOptions={confirmButtonOptions}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add bottom safe-area padding to the new Save footers

On devices with a bottom gesture/home-indicator inset, this new fixed Save footer receives only its regular pb5 spacing because the surrounding ScreenWrapper explicitly disables bottom safe-area padding and the SelectionList does not set addBottomSafeAreaPadding. The same combination occurs in all three changed pages, so their Save buttons can intrude into the unsafe area; pass addBottomSafeAreaPadding to each list or let the wrapper provide the inset.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot it is a valid concern. Please resolve it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed — fixed in 8fe8710. Each of the three pages sets includeSafeAreaPaddingBottom={false} on its ScreenWrapper, so the SelectionList's fixed Save footer (FixedFooter) was getting only its base pb5 spacing and no bottom inset. Passing addBottomSafeAreaPadding to each list makes FixedFooter add the device bottom inset (via useBottomSafeSafeAreaPaddingStyle → raw useSafeAreaPaddings), so the Save button no longer intrudes into the home-indicator/gesture area. Because the wrapper's bottom padding is disabled, there's no double-count, and since a footer is present the list's own container padding is skipped — the inset lands exactly on the footer. This matches the established pattern (e.g. CardTypeStep).

@truph01

truph01 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Remove the unnecessary comments you added in this PR

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done in a3649dd — removed the redundant draft-state explanation comments from all three pages (the two-line // Keep the draft undefined… / // This avoids freezing… blocks). The draftX ?? currentX pattern is self-explanatory, so they weren't adding much.

I kept one comment: DynamicVisibilityPage.tsx:64// Selecting Public is a sensitive change, so it still has to be confirmed before we persist it. — because lakchote explicitly requested it in review and it explains genuinely non-obvious behavior. Let me know if you'd like that one dropped too.

@truph01

truph01 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained """"why"""" the code was doing something instead of only explaining """"what"""" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-07-26.at.21.08.24.mov
Screen.Recording.2026-07-26.at.21.09.37.mov
Screen.Recording.2026-07-26.at.21.11.47.mov
Android: mWeb Chrome
iOS: HybridApp
Screen.Recording.2026-07-26.at.21.18.30.mov
iOS: mWeb Safari
Screen.Recording.2026-07-26.at.21.16.30.mov
MacOS: Chrome / Safari
Screen.Recording.2026-07-26.at.21.17.17.mov

@truph01

truph01 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot merge main

…ttings-save

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Merged main into the branch (d9fed54). No conflicts — clean merge, and all three addBottomSafeAreaPadding changes are intact.

@truph01 truph01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot Please resolve these comments


const changeVisibility = (newVisibility: RoomVisibility) => {
if (!report) {
const saveVisibility = async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Public confirmation modal triggers when nothing changed

If a room is already public and the user taps Save without selecting a different option, selectedVisibility falls back to report?.visibility which is PUBLIC, so the "Are you sure?" modal still pops up. Could we gate the modal on draftVisibility being set — or skip the confirmation when selectedVisibility === report?.visibility?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed by the same change in d8abb61. Save is now disabled while selectedVisibility === report?.visibility (DynamicVisibilityPage.tsx:86), so the exact scenario you described — an already-public room where the user hasn't picked a different option — leaves the button disabled and the "Are you sure?" modal can't fire. The modal now only appears when Public is an actual change from the room's current visibility, which is when we do want the confirmation.

goBack();
};

const confirmButtonOptions = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Save enabled with no changes

All three pages let the user tap Save without selecting a different option, which fires the update API with old === new. Would it make sense to disable the button while draftWriteCapability is undefined (and same for the other two pages)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — done in d8abb61. All three Save buttons are now disabled whenever the selected value equals the current live value, i.e. selected === current (which is exactly the case when the draft is still undefined and when the user re-picks the option that's already active), so the update API is never fired with old === new:

@melvin-bot
melvin-bot Bot requested a review from lakchote July 27, 2026 02:49
@truph01

truph01 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The Jest Unit Tests / test (job 4) (pull_request) isn't related to this PR.

@lakchote lakchote left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@lakchote lakchote self-assigned this Jul 27, 2026
@lakchote

Copy link
Copy Markdown
Contributor

@MelvinBot merge latest main here

…ttings-save

Co-authored-by: Lucien Akchoté <lakchote@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Merged the latest main into this branch in d347e01 and pushed. It was a clean merge with no conflicts (the branch was 201 commits behind main), and the PR's changes are intact.

@lakchote lakchote assigned lakchote and unassigned lakchote Jul 27, 2026
@lakchote

Copy link
Copy Markdown
Contributor

@MelvinBot merge latest main here

…ttings-save

Co-authored-by: Lucien Akchoté <lakchote@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Merged latest main into the branch in bae8c56 (via git merge, no rebase/force-push). The merge was clean — no conflicts, and none of the three changed Report settings pages were touched by incoming commits, so this PR's changes are intact. Pushed to claude-a11y-report-settings-save.

@lakchote lakchote removed their assignment Jul 27, 2026
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.

3 participants