Skip to content

Fix UI break when user rejects mic permission#1196

Open
jaykim1213 wants to merge 8 commits intodevfrom
jk/fixMicPermissionBug
Open

Fix UI break when user rejects mic permission#1196
jaykim1213 wants to merge 8 commits intodevfrom
jk/fixMicPermissionBug

Conversation

@jaykim1213
Copy link
Copy Markdown
Contributor

@jaykim1213 jaykim1213 commented Apr 10, 2026

Does this PR close any open issues?

Closes #1171

Give a longer description of what this PR addresses and why it's needed

  • Fix the UI break when the user rejects mic permission
  • Make the mic icon disabled when the user rejects permission
  • Fix library-mic-check and library-screen-recording config.json files
  • Fix the library-calvi question description, which had the wrong description
  • Add screen recording icon to timeline as well

Provide pictures/videos of the behavior before and after these changes (optional)

Fix the UI break when the user rejects mic permission
Before

Screenshot 2026-04-10 at 1 00 04 PM

After

Screenshot 2026-04-16 at 8 54 40 AM

Add screen recording icon to timeline as well

Screenshot 2026-04-10 at 1 32 51 PM

Are there any additional TODOs before this PR is ready to go?

TODOs:

  • Update relevant documentation
  • ...

@jaykim1213 jaykim1213 requested a review from Copilot April 10, 2026 19:01
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 10, 2026

A preview of 503a9c7 is uploaded and can be seen here:

https://revisit.dev/study/PR1196

Changes may take a few minutes to propagate.

@jaykim1213 jaykim1213 changed the title Fix typo in library calvi question description Fix UI break when user rejects mic permission Apr 10, 2026
@jaykim1213 jaykim1213 linked an issue Apr 10, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses UI instability when microphone permission is denied by introducing explicit audio-recording error state and updating header rendering to avoid showing the live waveform in error scenarios. It also corrects several library/example configs so recording flags are set on the right components, and fixes a CALVI library description typo.

Changes:

  • Add audioRecordingError state to the recording hook and surface it via context.
  • Update AppHeader to suppress “Recording audio” UI and show a disabled mic indicator with an error tooltip when mic access fails.
  • Fix library/example config.json flags (recordScreen / recordAudio) and correct the CALVI question description.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/store/hooks/useRecording.ts Adds audioRecordingError and sets it on getUserMedia failure.
src/components/interface/AppHeader.tsx Uses audioRecordingError to hide waveform/text and show a mic-error indicator.
public/library-screen-recording/config.json Updates the example study UI config (removes recordScreen).
public/libraries/screen-recording/config.json Sets recordScreen: true on the permission component and normalizes JSON formatting.
public/libraries/mic-check/config.json Enables recordAudio: true for mic-check component.
public/libraries/calvi/config.json Fixes the N1 component description text.
Comments suppressed due to low confidence (1)

src/store/hooks/useRecording.ts:298

  • In startAudioRecording, setIsAudioRecording(true) is executed unconditionally (and before getUserMedia() resolves). If the user denies permission, audioMediaRecorder.current stays null but isAudioRecording remains true, which can leak the “audio recording” UI into later non-audio components and can still briefly mount RecordingAudioWaveform before audioRecordingError is set (reintroducing the header layout break). Consider setting isAudioRecording to true only after the stream/recorder is successfully created, and setting it back to false in the .catch(); if you still need to render a disabled mic icon globally, separate “micUnavailable”/permission state from “isAudioRecording” and clear/set audioRecordingError at the start of each attempt.
      recorder.start();
      setAudioRecordingError(null);
    }).catch((err) => {
      console.error('Error accessing microphone:', err);
      setAudioRecordingError('Microphone permission denied or not supported.');
    });

    setIsAudioRecording(true);
  }, [storageEngine, isMuted]);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread public/library-screen-recording/config.json
Comment thread src/components/interface/AppHeader.tsx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/store/hooks/useRecording.ts Outdated
@jaykim1213 jaykim1213 marked this pull request as ready for review April 10, 2026 20:11
@jaykim1213 jaykim1213 marked this pull request as draft April 10, 2026 21:59
@jaykim1213 jaykim1213 marked this pull request as ready for review April 16, 2026 14:46
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.

Fix UI break when microphone permission is denied

2 participants