Skip to content

fix(timer): Improve timer UI/UX - #24144

Merged
lfzawacki merged 20 commits into
bigbluebutton:v3.1.x-releasefrom
guiiBecker:v3.1-2457
Jan 5, 2026
Merged

lfzawacki merged 20 commits into
bigbluebutton:v3.1.x-releasefrom
guiiBecker:v3.1-2457

Conversation

@guiiBecker

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR improves the overall UI/UX of the timer component:

  • Redesigned timer interface for better usability and visual consistency
  • Added preset durations for quick timer setup
  • Introduced quick input options for manual time entry
  • Added increment/decrement arrows for fine-tuning the timer value
  • Updated music selection component with a new, modern style
image

@coderabbitai

coderabbitai Bot commented Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR refactors the timer component from a single input field to a multi-unit time selection interface. It introduces configuration-driven behavior with support for maximum hours, preset times, and quick-add buttons. The component now features individual hour/minute/second controls with increment/decrement buttons and preset time buttons with navigation. A local state synchronization pattern with debounced backend syncing is implemented to manage time updates. Supporting infrastructure additions include new timer utility functions for time calculations and formatting, configuration entries, type definitions, and localization strings for accessibility labels.

Sequence Diagram

sequenceDiagram
    participant User
    participant TimerUI as Timer UI Component
    participant LocalState as Local State<br/>(hours/mins/secs)
    participant Debounce as Debounce Scheduler
    participant Backend as Backend/Server

    User->>TimerUI: Click increment hours
    TimerUI->>LocalState: Update localHours
    LocalState->>Debounce: Schedule sync (short delay)
    
    User->>TimerUI: Click increment minutes
    TimerUI->>LocalState: Update localMinutes
    LocalState->>Debounce: Reschedule sync
    
    Note over Debounce: Delay elapsed (no new edits)
    Debounce->>Backend: syncTimeWithBackend(totalSeconds)
    Backend-->>Debounce: Acknowledge

    User->>TimerUI: Click preset button
    TimerUI->>LocalState: setAbsoluteTime(presetSeconds)<br/>Update all units
    LocalState->>Backend: Sync immediately via start action
    Backend-->>TimerUI: Time updated

    User->>TimerUI: Click add 5 minutes
    TimerUI->>LocalState: addTimeWithBounds(+300s)
    LocalState->>Debounce: Schedule sync
    
    User->>TimerUI: Focus blur / Start button
    TimerUI->>LocalState: Finalize local time
    LocalState->>Backend: syncTimeWithBackend
    Backend-->>TimerUI: Confirmed
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • component.tsx: Extensive refactoring with new state management pattern (local time state, debounced syncing, multiple effect hooks); requires careful verification of time calculation logic, state synchronization timing, and integration between UI actions and backend updates
  • service.ts: Nine new utility functions with boundary-aware time arithmetic (increment, decrement, conversion, addition with bounds); edge cases for overflow/underflow and maximum time constraints need thorough validation
  • styles.ts: Large number of new styled components (10+) with conditional styling based on state (isSelected, disabled); verify visual consistency and responsive behavior
  • Configuration/Type definitions: Ensure new fields (maxHours, presets, quickAddButtons) propagate correctly through settings.yml, initial values, and TypeScript types
  • Accessibility: Verify all new ARIA labels are properly integrated and functional; validate that per-unit controls have correct aria-labels with dynamic values (amount in decrements/increments)
  • Integration points: Confirm debounced sync behavior doesn't create race conditions; verify preset selection, quick-add buttons, and per-unit increment/decrement all properly update backend state

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(timer): Improve timer UI/UX' accurately captures the main objective of the changeset—a comprehensive redesign of the timer component's user interface and experience with new controls, presets, and styling.
Description check ✅ Passed The description is directly related to the changeset, detailing the specific improvements made: redesigned interface, preset durations, quick input options, increment/decrement arrows, and updated music selection styling—all of which are reflected in the code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (6)
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (4)

274-281: Clamp absolute time to max (23:59:59) for safety.

Prevents out-of-range values if reused beyond fixed presets.

 const setAbsoluteTime = useCallback((totalSeconds: number) => {
   if (running) return;
-  const h = Math.floor(totalSeconds / 3600);
-  const m = Math.floor((totalSeconds % 3600) / 60);
-  const s = totalSeconds % 60;
+  const maxSeconds = (MAX_HOURS * 3600) + (59 * 60) + 59;
+  const clamped = Math.max(0, Math.min(totalSeconds, maxSeconds));
+  const h = Math.floor(clamped / 3600);
+  const m = Math.floor((clamped % 3600) / 60);
+  const s = clamped % 60;
   syncTimeWithBackend(h, m, s);
 }, [running, syncTimeWithBackend]);

283-289: Avoid rounding up minutes for non-hour presets.

Use floor to prevent “61 sec” showing “2min”. Low impact now (presets are multiples of 60), but safer.

-const minutes = Math.round(totalSeconds / 60);
+const minutes = Math.floor(totalSeconds / 60);

480-491: Localize preset aria-label.

Replace hardcoded English with i18n so SR users in non‑EN locales get correct text.

-aria-label={`Set timer to ${formatPresetLabel(secs)}`}
+aria-label={intl.formatMessage(intlMessages.presetAria, { timeLabel: formatPresetLabel(secs) })}

And add to defineMessages:

   secondsAbbr: {
     id: 'app.timer.abbreviation.seconds',
     description: 'Timer seconds abbreviation (e.g., sec)',
   },
+  presetAria: {
+    id: 'app.timer.aria.setPreset',
+    description: 'ARIA: set preset time',
+  },

510-526: Localize inline arrow aria-labels and use full unit names.

Abbreviations (“min +1”) are less clear for SRs and are hardcoded EN. Use i18n with full unit labels.

-aria-label={`${intl.formatMessage(intlMessages.hoursAbbr)} +1`}
+aria-label={intl.formatMessage(intlMessages.incUnitAria, { unit: intl.formatMessage(intlMessages.hours) })}
...
-aria-label={`${intl.formatMessage(intlMessages.hoursAbbr)} -1`}
+aria-label={intl.formatMessage(intlMessages.decUnitAria, { unit: intl.formatMessage(intlMessages.hours) })}

Repeat similarly for minutes/seconds, and add messages:

+  incUnitAria: {
+    id: 'app.timer.aria.incrementUnit',
+    description: 'ARIA: increase unit by 1',
+  },
+  decUnitAria: {
+    id: 'app.timer.aria.decrementUnit',
+    description: 'ARIA: decrease unit by 1',
+  },

I can push a patch wiring these messages across all three units if preferred.

Also applies to: 547-563, 584-600

bigbluebutton-html5/imports/ui/components/timer/panel/styles.ts (2)

274-288: Add a visible keyboard focus for arrow buttons.

Custom button resets remove native outline; add :focus-visible for a11y.

 const InputArrowButton = styled.button<{disabled?: boolean}>`
   all: unset;
   cursor: pointer;
   flex: 1;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 0.6rem;
   line-height: 1;
   text-align: center;
   color: ${colorText};
   user-select: none;
   &:hover, &:focus { opacity: 1; color: ${colorPrimary}; }
+  &:focus-visible { outline: 2px solid ${colorPrimary}; outline-offset: 1px; }
   &:active { transform: translateY(1px); }
 `;

359-393: Add keyboard focus style to preset buttons.

Same reason as arrows; improves discoverability for SR/keyboard users.

 const TimerPresetButton = styled.button<{disabled?: boolean}>`
   all: unset;
   cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
   font-size: 0.95rem;
   line-height: 1;
   color: ${colorGrayDark};
   opacity: ${({ disabled }) => (disabled ? 0.4 : 0.7)};
   transition: opacity 120ms ease, color 120ms ease, background-color 120ms ease, border-color 120ms ease;
   padding: 0.25rem 0.15rem;
   border: 1px solid ${colorBorder};
   border-radius: 0.35rem;
 
   &:hover, &:focus {
     opacity: 1;
     color: ${colorGrayDark};
   }
+  &:focus-visible { outline: 2px solid ${colorPrimary}; outline-offset: 1px; }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57fadf6 and 17bd397.

📒 Files selected for processing (3)
  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (7 hunks)
  • bigbluebutton-html5/imports/ui/components/timer/panel/styles.ts (12 hunks)
  • bigbluebutton-html5/public/locales/en.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
bigbluebutton-html5/imports/ui/components/timer/panel/styles.ts (2)
bigbluebutton-html5/imports/ui/stylesheets/styled-components/palette.js (6)
  • colorGrayDark (7-7)
  • colorBlueLighter (17-17)
  • colorPrimary (29-29)
  • colorGray (6-6)
  • colorText (45-45)
  • colorBorder (14-14)
bigbluebutton-html5/imports/ui/stylesheets/styled-components/general.js (1)
  • borderRadiusRounded (12-12)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-package (bbb-html5)
🔇 Additional comments (1)
bigbluebutton-html5/public/locales/en.json (1)

111-113: Add ARIA strings and propagate timer abbreviations to all locales.

en.json already adds the unit abbreviations, but most non‑English locale files are missing them and the three new ARIA keys are absent everywhere. Add the ARIA keys to en.json and propagate equivalents/placeholders to the other locale files; also confirm the timer component path so any hardcoded aria-labels are replaced with these keys.

Suggested keys to add near the abbreviations in bigbluebutton-html5/public/locales/en.json:

   "app.timer.abbreviation.hours": "h",
   "app.timer.abbreviation.minutes": "min",
   "app.timer.abbreviation.seconds": "sec",
+  "app.timer.aria.setPreset": "Set timer to {timeLabel}",
+  "app.timer.aria.incrementUnit": "Increase {unit} by 1",
+  "app.timer.aria.decrementUnit": "Decrease {unit} by 1",

@antobinary antobinary added this to the Release 3.1 milestone Oct 28, 2025
const formatPresetLabel = useCallback((totalSeconds: number) => {
const hours = totalSeconds / 3600;
if (Number.isInteger(hours) && hours >= 1) {
return `${hours}${intl.formatMessage(intlMessages.hoursAbbr)}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please include hours/minutes variables in the intl message instead of concatenating it, as concatenation may cause issues in RTL languages (see #21660)

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.

Thanks for the warnings, Ramon. I fixed them in the commit 94434fb.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17bd397 and 94434fb.

📒 Files selected for processing (2)
  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (7 hunks)
  • bigbluebutton-html5/public/locales/en.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • bigbluebutton-html5/public/locales/en.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-15T17:52:37.432Z
Learnt from: guiiBecker
PR: bigbluebutton/bigbluebutton#24084
File: bigbluebutton-html5/public/locales/pt.json:323-323
Timestamp: 2025-10-15T17:52:37.432Z
Learning: Translation issues in locale files (bigbluebutton-html5/public/locales/*.json) should be updated in Transifex, the translation management platform used by the BigBlueButton project, rather than being fixed directly in pull requests.

Applied to files:

  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-package (bbb-html5)
🔇 Additional comments (10)
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (10)

43-52: LGTM!

The preset values are well-chosen for common timer durations and the comment clearly indicates localization is handled separately.


99-122: LGTM!

The new intl messages are properly structured to support localization and RTL languages by using message formatting with variables instead of string concatenation.


171-173: LGTM!

The input refs are properly declared and enable smooth focus management during carry-over operations.


229-245: LGTM!

The minutes carry-over logic correctly propagates values >= 60 into hours, respects the MAX_HOURS cap, and provides good UX by focusing the hours input after carry-over.


247-263: LGTM!

The seconds carry-over logic now correctly propagates through minutes and hours, addressing the previous review's concern about incorrect minute caps. The implementation properly handles edge cases like 01:59:00 + 120 seconds → 02:01:00.


281-287: LGTM!

The setAbsoluteTime function cleanly converts total seconds to hours/minutes/seconds and properly guards against changes when the timer is running.


289-303: LGTM!

The formatPresetLabel function properly uses intl message formatting with variables, which correctly handles RTL languages and allows translators to control unit placement.


308-320: LGTM!

The incUnit/decUnit helpers cleanly integrate with the existing changeTime logic and provide appropriate visual feedback by updating focusedUnit.


364-364: LGTM!

The isSelected prop correctly reflects the currently selected track for visual styling.


493-505: LGTM!

The preset buttons provide excellent UX with properly localized labels and ARIA attributes that support accessibility and RTL languages.

@Tainan404

Tainan404 commented Oct 31, 2025 •

Copy link
Copy Markdown
Member
  1. Keyboard navigation isn't working, in 3.0 I'm able to navigate between inputs using Tab key, on 3.1 I'm not able to naviagate.
  2. The panel has a horizontal scroll that is not desible, the items overflowing should or break to a new line or have the width fitting the container width.
Screencast.from.30-10-2025.22.28.16.webm

"app.timer.abbreviation.hours": "h",
"app.timer.abbreviation.minutes": "min",
"app.timer.abbreviation.seconds": "sec",
"app.timer.preset.hours": "{hours}{abbr}",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You just moved the interpolation to inside the react intl, avoid this case of use, implement the full string here or make changes in the one that are receiving 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.

I believe I’ve covered most of the suggestions. I adjusted the suggested blur behavior — it now updates the timer only when the user stops editing each input. The quick add and preset buttons now use values from the configuration files, and I also removed string interpolation. Thanks for the suggestions!

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2025

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (6)
bigbluebutton-html5/private/config/settings.yml (1)

762-770: Avoid hardcoding visible labels in config; compute from i18n instead.

quickAddButtons[].label won’t localize per user. Prefer storing only seconds here and generate both visible label and aria-label via intl in the component (e.g., using ICU plurals or Intl.NumberFormat with unit style). Also ensure all preset values fit within maxHours (≤ maxHours:59:59) or clamp in code.

Would you like a patch to drop label and derive it in the UI?

bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts (1)

532-538: Validate presets against maxHours or clamp in UI.

If an admin configures a preset > maxHours:59:59, setAbsoluteTime currently accepts it unbounded. Either validate here or clamp in the UI (see component comment).

bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts (1)

516-525: Type polish for new timer fields.

  • Document maxHours as a non-negative integer (practically 0–23 by default).
  • Prefer deriving button text in UI; consider deprecating QuickAddButton.label to avoid non-localized strings in config.

Optionally, tighten with branded types or runtime guards when reading config.

bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (3)

320-338: Reduce server churn: avoid syncing on every +/- click.

changeTime immediately calls syncTimeWithBackend, so each arrow/quick-add click triggers a mutation. Earlier you aimed to “sync on blur/start”. Consider updating local state here and deferring sync to blur/start (or debounce ~250ms).

-    setLocalSeconds(s);
-    syncTimeWithBackend(h, m, s);
+    setLocalSeconds(s);
+    // Defer sync to blur/start, or debounce a short flush

369-374: Highlight the active preset for better UX.

isActive is hardcoded to false. Compare secs with the current local total seconds to indicate selection.

-  const visiblePresets = totalPresets > 0 ? visibleOffsets.map((offset) => {
+  const currentTotal = (localHours * 3600) + (localMinutes * 60) + localSeconds;
+  const visiblePresets = totalPresets > 0 ? visibleOffsets.map((offset) => {
     const idx = (currentPresetIndex + offset + totalPresets) % totalPresets;
-    return { secs: PRESET_SECONDS[idx], isActive: false, idx };
+    const secs = PRESET_SECONDS[idx];
+    return { secs, isActive: secs === currentTotal, idx };
   }) : [];

750-767: Localize quick-add visible labels and duration text.

  • Visible {label} comes from settings and won’t translate per user. Derive it via intl (e.g., “+{n}m”, “+{n}s”) and keep config as numbers only.
  • timeLabel is built in English and then injected into an intl string; build it with intl plurals:
- const timeLabel = seconds >= 60
-   ? `${Math.floor(seconds / 60)} minute${Math.floor(seconds / 60) > 1 ? 's' : ''}`
-   : `${seconds} second${seconds > 1 ? 's' : ''}`;
+ const mins = Math.floor(seconds / 60);
+ const timeLabel = seconds >= 60
+   ? intl.formatMessage({ id: 'app.timer.duration.minutes', defaultMessage: '{count, plural, one {# minute} other {# minutes}}' }, { count: mins })
+   : intl.formatMessage({ id: 'app.timer.duration.seconds', defaultMessage: '{count, plural, one {# second} other {# seconds}}' }, { count: seconds });

And render button text from intl too.

Based on learnings.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94434fb and 583fe9e.

📒 Files selected for processing (6)
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (8 hunks)
  • bigbluebutton-html5/imports/ui/components/timer/panel/styles.ts (13 hunks)
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts (1 hunks)
  • bigbluebutton-html5/private/config/settings.yml (1 hunks)
  • bigbluebutton-html5/public/locales/en.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • bigbluebutton-html5/imports/ui/components/timer/panel/styles.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-15T17:52:37.432Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/pt.json:323-323
Timestamp: 2025-10-15T17:52:37.432Z
Learning: Translation issues in locale files (bigbluebutton-html5/public/locales/*.json) should be updated in Transifex, the translation management platform used by the BigBlueButton project, rather than being fixed directly in pull requests.

Applied to files:

  • bigbluebutton-html5/public/locales/en.json
  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-package (bbb-html5)
🔇 Additional comments (5)
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (5)

434-447: LGTM: selected track styling.

Passing isSelected to TimerTrackItem improves clarity without changing behavior.


498-507: LGTM: sync local time on start.

Ensures backend time matches what’s in the inputs before starting the countdown.


205-211: Nice touch: transient focus highlight.

The 3s auto-clear for the focused unit reduces persistent highlight.


605-746: No changes needed; implementation is sound.

The code's tabIndex usage is justified and appropriate. Inputs correctly set tabIndex={running ? -1 : 0} to enable/disable focus based on timer state, while arrow buttons are correctly excluded with tabIndex={-1} since they're controlled via onClick. All inputs share the same explicit value, so they naturally follow source order—this is not problematic.

The InputArrows overlay via position: absolute; right: 0 is intentional design, not a defect. Focus management is well-handled through setFocusedUnit state tracking, refs, and programmatic focus. No z-index conflicts, horizontal scroll issues, or focus traps exist. The component includes proper ARIA attributes and follows accessibility best practices.

Likely an incorrect or invalid review comment.


565-603: Add aria-controls to PresetArrowButton to indicate the presets row.

The review comment is partially valid. aria-controls is confirmed missing from the PresetArrowButton usage—this should be added to associate the arrow controls with TimerPresetsRow.

However, verification of whether PresetArrowButton renders a native <button> element cannot be completed because the Button component source (imported as /imports/ui/components/common/button/component) uses Meteor module resolution and is not accessible. You should manually verify that the underlying Button component renders a semantic <button> element and properly supports the disabled attribute natively, rather than relying on role="button" on a styled div.

Comment on lines +181 to +186
// timer settings from config
const TIMER_CONFIG = window.meetingClientSettings.public.timer;
const MAX_HOURS = TIMER_CONFIG.maxHours;
const PRESET_SECONDS = TIMER_CONFIG.presets;
const QUICK_ADD_BUTTONS = TIMER_CONFIG.quickAddButtons;

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.

⚠️ Potential issue | 🟡 Minor

Guard access to global settings and add sane fallbacks.

If window.meetingClientSettings?.public?.timer is missing, these reads will throw. Add optional chaining and defaults to avoid breaking the panel.

-  const TIMER_CONFIG = window.meetingClientSettings.public.timer;
+  const TIMER_CONFIG = window?.meetingClientSettings?.public?.timer ?? { maxHours: 23, presets: [], quickAddButtons: [] as {seconds:number;label?:string}[] };
🤖 Prompt for AI Agents
In bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx around
lines 181 to 186, accessing window.meetingClientSettings.public.timer can throw
if the object is missing; guard the access with optional chaining and provide
sane defaults: read TIMER_CONFIG as window.meetingClientSettings?.public?.timer
?? {}, set MAX_HOURS to a default number (e.g. 24) if missing, PRESET_SECONDS to
an empty array or sensible presets (e.g. [60,300,600]) if missing, and
QUICK_ADD_BUTTONS to an empty array (or default buttons) if missing; ensure the
rest of the code expects these types (number/array) so no further runtime errors
occur.

Comment on lines +339 to +349
const setAbsoluteTime = useCallback((totalSeconds: number) => {
if (running) return;
const h = Math.floor(totalSeconds / 3600);
const m = Math.floor((totalSeconds % 3600) / 60);
const s = totalSeconds % 60;
setLocalHours(h);
setLocalMinutes(m);
setLocalSeconds(s);
syncTimeWithBackend(h, m, s);
}, [running, syncTimeWithBackend]);

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.

⚠️ Potential issue | 🟠 Major

Clamp setAbsoluteTime to MAX_HOURS to prevent out-of-range values.

If a preset exceeds the allowed max, this can push hours beyond MAX_HOURS. Clamp total seconds like in changeTime.

-  const setAbsoluteTime = useCallback((totalSeconds: number) => {
+  const setAbsoluteTime = useCallback((totalSeconds: number) => {
     if (running) return;
-    const h = Math.floor(totalSeconds / 3600);
+    const maxSeconds = (MAX_HOURS * 3600) + (59 * 60) + 59;
+    const clamped = Math.max(0, Math.min(totalSeconds, maxSeconds));
+    const h = Math.floor(clamped / 3600);
-    const m = Math.floor((totalSeconds % 3600) / 60);
-    const s = totalSeconds % 60;
+    const m = Math.floor((clamped % 3600) / 60);
+    const s = clamped % 60;
     setLocalHours(h);
     setLocalMinutes(m);
     setLocalSeconds(s);
     syncTimeWithBackend(h, m, s);
-  }, [running, syncTimeWithBackend]);
+  }, [running, syncTimeWithBackend, MAX_HOURS]);
🤖 Prompt for AI Agents
In bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx around
lines 339 to 349, setAbsoluteTime can compute hours from an unbounded
totalSeconds causing hours to exceed MAX_HOURS; clamp totalSeconds to MAX_HOURS
* 3600 before splitting into h/m/s (e.g. use a clampedTotal =
Math.min(totalSeconds, MAX_HOURS * 3600)), then derive h, m, s from
clampedTotal, preserve the existing running check and state setters, and call
syncTimeWithBackend with the clamped values so hours never go out of range.

Comment on lines +111 to +120
"app.timer.aria.setTo": "Set timer to {label}",
"app.timer.aria.prevPreset": "Previous preset",
"app.timer.aria.nextPreset": "Next preset",
"app.timer.aria.decrementHours": "Decrease hours by {amount}",
"app.timer.aria.incrementHours": "Increase hours by {amount}",
"app.timer.aria.decrementMinutes": "Decrease minutes by {amount}",
"app.timer.aria.incrementMinutes": "Increase minutes by {amount}",
"app.timer.aria.decrementSeconds": "Decrease seconds by {amount}",
"app.timer.aria.incrementSeconds": "Increase seconds by {amount}",
"app.timer.aria.addTime": "Add {time}",

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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Good ARIA additions; consider adding duration pluralization.

The new keys look right. For “Add {time}” ensure {time} is produced by intl (not an English string). Add a dedicated pluralized helper message, e.g.:

  • "app.timer.duration": "{count, plural, one {# second} other {# seconds}}" and a minutes variant; then compose “Add {duration}”.

Also, component.tsx defines app.timer.preset.hours and app.timer.preset.minutes but they aren’t present here. Either add them or remove the unused messages.

I can open a follow-up to add the missing keys and pluralized helpers.


🏁 Script executed:

#!/bin/bash
# Find timer-related component files
fd -t f -e tsx -e ts -e jsx -e js | grep -i timer | head -20

Length of output: 1097


🏁 Script executed:

#!/bin/bash
# Search for app.timer.preset references in codebase
rg 'app\.timer\.preset\.(hours|minutes)' -n -B2 -A2

Length of output: 907


🏁 Script executed:

#!/bin/bash
# Display the full timer locale section from en.json to verify key presence
rg 'app\.timer\.' bigbluebutton-html5/public/locales/en.json -n | head -40

Length of output: 1942


🏁 Script executed:

#!/bin/bash
# Search for how {time} placeholder is used in timer context
rg 'app\.timer\.aria\.addTime|{time}' -n -B3 -A3 -t json -t ts -t tsx

Length of output: 133


🏁 Script executed:

#!/bin/bash
# Search for how addTime message and {time} placeholder is used
rg 'addTime|app\.timer\.aria' bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx -n -B3 -A3

Length of output: 1836


🏁 Script executed:

#!/bin/bash
# Examine the timer panel component to see how messages are constructed
cat bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx | head -150

Length of output: 3890


🏁 Script executed:

#!/bin/bash
# Search for preset.hours and preset.minutes usage across all files
rg 'preset\.(hours|minutes)' -n -B2 -A2

Length of output: 907


🏁 Script executed:

#!/bin/bash
# Check if app.timer.preset.hours/minutes exist anywhere else in locale files
rg 'app\.timer\.preset\.(hours|minutes)' bigbluebutton-html5/public/locales/ -n

Length of output: 0


Add missing app.timer.preset.hours and app.timer.preset.minutes keys to en.json.

The component (line 87-94) references these localization IDs but they're missing from the locale file. They need to be added.

The {time} placeholder concern is not applicable—it's correctly populated via intl.formatMessage(intlMessages.addTime, { time: timeLabel }) (component line 760), where timeLabel is dynamically generated and localized.

The pluralization suggestion for duration helpers remains valid as an optional improvement for future work.

🤖 Prompt for AI Agents
In bigbluebutton-html5/public/locales/en.json around lines 111-120 (component
references at lines 87-94), add the missing localization keys
app.timer.preset.hours and app.timer.preset.minutes so the component can resolve
them; set their English values to "Hours" and "Minutes" respectively (matching
the style of other entries) and ensure they are placed within the same JSON
object scope and formatted as the other keys in the file.

const newHours = Math.min(localHours + carryOver, MAX_HOURS);
setLocalHours(newHours);
setLocalMinutes(newMinutes);
hoursInputRef.current?.focus();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still makes sense this variable behavior, the component loses focus for some reason on this new approach?

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.

I personally think it makes sense. When you type a value over 60 in the minutes field (like 75), the code automatically converts it to hours (1h 15min) and moves the focus to the hours field so you can see the change. The .select() still keeps the number highlighted, so if you didn’t want that, you can just type again. What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it!

}, [running, syncTimeWithBackend]);

// format preset labels(e.g., 0:05:00)
const formatPresetLabel = useCallback((totalSeconds: number) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest move this util functions to a service, this way the component keeps clean and don't have a chance of cause re-renders

{QUICK_ADD_BUTTONS.map(({ seconds, label }) => {
const testId = `add${seconds}s`;
const timeLabel = seconds >= 60
? `${Math.floor(seconds / 60)} minute${Math.floor(seconds / 60) > 1 ? 's' : ''}`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minutes aren't being translated

presets: [60, 300, 600, 900, 1200, 1800, 3600]
quickAddButtons:
- seconds: 30
label: '+0:30'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does label cannot be generated from seconds?

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.

I made it manual to give flexibility—like, you might want a custom or shorter label. By keeping the label manual, you have full control and can put something like "+30s", "+30sec", or anything else.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, but a meeting can have a user with client on portuguese and another one with browser on japanese or english or arabic that would break it, when thinking on labels we should always think it global and using intl

const testId = `add${seconds}s`;
const timeLabel = seconds >= 60
? `${Math.floor(seconds / 60)} minute${Math.floor(seconds / 60) > 1 ? 's' : ''}`
: `${seconds} second${seconds > 1 ? 's' : ''}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

aren't being translated

track2: "CalmMusic"
track3: "aristocratDrums"
time: 5
maxHours: 23

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some reason to have a max hour?

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.

The 23-hour limit exists to keep the familiar format (like a 0–23h clock) and to prevent someone from accidentally entering absurd values like 999 hours.

useEffect(() => {
if (!focusedUnit || running) return undefined;

const timeout = setTimeout(() => setFocusedUnit(null), 3000);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why?

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.

This is just to perform a visual cleanup on the screen, for example, when the user clicks on one of the presets, so that it doesn’t remain displayed for too long or until the user clicks elsewhere on the component. The main purpose is more for a visual cleanup for the user.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would not be easy the proper button handle itself? looking at the code, I had no clue what this were doing, it prefereble it trigger with the click callback rather have it global

}
};

const handleMinutesBlur = () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why theses function don't have a useCallback or be called directly on event?

@Tainan404

Copy link
Copy Markdown
Member

I was testing it and noticed that the inputs actully don't send the new values on every execution, but the arrow buttons do

Screencast.from.10-11-2025.16.12.28.webm

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (1)

373-426: Add cleanup for syncTimeoutRef on unmount.

The debounced sync pattern is well-implemented, but the timeout should be cleared when the component unmounts to prevent potential memory leaks or stale updates.

Add a cleanup effect:

useEffect(() => {
  return () => {
    if (syncTimeoutRef.current) {
      clearTimeout(syncTimeoutRef.current);
    }
  };
}, []);
bigbluebutton-html5/imports/ui/components/timer/utils.ts (1)

42-54: Consider adding a comment for the isActive field.

The function always returns isActive: false in the preset objects. A brief comment explaining this (e.g., "isActive reserved for future enhancement" or "isActive determined by caller") would improve code clarity.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 583fe9e and 65df31c.

📒 Files selected for processing (5)
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (8 hunks)
  • bigbluebutton-html5/imports/ui/components/timer/utils.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts (1 hunks)
  • bigbluebutton-html5/private/config/settings.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • bigbluebutton-html5/private/config/settings.yml
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-15T17:52:37.432Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/pt.json:323-323
Timestamp: 2025-10-15T17:52:37.432Z
Learning: Translation issues in locale files (bigbluebutton-html5/public/locales/*.json) should be updated in Transifex, the translation management platform used by the BigBlueButton project, rather than being fixed directly in pull requests.

Applied to files:

  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx
🧬 Code graph analysis (2)
bigbluebutton-html5/imports/ui/components/timer/utils.ts (1)
bigbluebutton-tests/playwright/user/util.js (1)
  • minutes (42-42)
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (1)
bigbluebutton-html5/imports/ui/components/timer/utils.ts (8)
  • addTimeWithBounds (180-194)
  • convertSecondsToTime (153-158)
  • getNextPresetIndex (21-23)
  • getPrevPresetIndex (31-33)
  • getVisiblePresets (42-54)
  • incrementTimeUnit (65-97)
  • decrementTimeUnit (107-146)
  • formatPresetLabel (6-13)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-package (bbb-html5)
🔇 Additional comments (10)
bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts (1)

532-534: LGTM!

The new timer configuration fields are well-chosen and provide sensible defaults for the enhanced timer UI. The preset durations cover common use cases, and the quick-add buttons offer convenient incremental adjustments.

bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (4)

640-783: Keyboard navigation implementation looks correct.

The tabIndex logic properly enables Tab key navigation between inputs when the timer is not running, while keeping the arrow buttons out of the tab order. This should address the keyboard navigation issue reported in the PR comments.


533-547: LGTM!

The start button correctly syncs local input state to the backend before starting the timer, ensuring that any pending edits are applied. This addresses the input update inconsistency issue reported in the PR objectives.


600-639: LGTM!

The preset navigation UI is well-implemented with proper accessibility support. The aria-labels are internationalized, and the carousel pattern provides good UX for browsing through available presets.


224-230: Verify sync behavior during concurrent edits.

This effect syncs local input state with server state whenever the timer is not running. If multiple users edit the timer simultaneously (or the server state changes while a user is typing), this will overwrite the user's local edits.

Consider adding a flag to skip syncing while a user has focused an input field, or verify that this overwrites-on-change behavior is the intended design for concurrent editing scenarios.

bigbluebutton-html5/imports/ui/components/timer/utils.ts (5)

6-13: LGTM!

The formatting logic correctly handles all cases including zero, and produces consistent H:MM:SS output with proper padding.


21-33: LGTM!

The circular navigation functions are correctly implemented using the standard modulo pattern. The getPrevPresetIndex properly handles the negative case by adding totalPresets before the modulo operation.


65-97: LGTM!

The increment logic correctly handles carry-over across all time units while respecting the maximum hours constraint at each step.


107-146: LGTM!

The decrement logic correctly handles borrowing across time units while preventing negative values. Edge cases like 0:00:00 are properly handled.


153-194: LGTM!

The time conversion and bounded addition functions are correctly implemented. The separation of concerns (conversion vs. bounds checking) is appropriate, with addTimeWithBounds providing the clamping behavior when needed.

@lfzawacki
lfzawacki requested a review from Tainan404 December 9, 2025 18:40
@github-actions

Copy link
Copy Markdown

Automated tests Summary

⏳ Tests are running...

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

♻️ Duplicate comments (2)
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (2)

192-200: Guard config access with optional chaining and provide defaults.

Lines 193-195 directly access window.meetingClientSettings.public.timer without guards, which will throw if the config is missing. This was flagged in previous review comments.

Apply this diff to add guards and defaults:

-  const TIMER_CONFIG = window.meetingClientSettings.public.timer;
-  const MAX_HOURS = TIMER_CONFIG.maxHours;
-  const PRESET_SECONDS = TIMER_CONFIG.presets;
+  const TIMER_CONFIG = window?.meetingClientSettings?.public?.timer ?? { 
+    maxHours: 24, 
+    presets: [60, 300, 600, 900, 1800], 
+    quickAddButtons: [30, 60, 300],
+    music: { enabled: false },
+    time: 5
+  };
+  const MAX_HOURS = TIMER_CONFIG.maxHours ?? 24;
+  const PRESET_SECONDS = Array.isArray(TIMER_CONFIG.presets) ? TIMER_CONFIG.presets : [60, 300, 600, 900, 1800];
 
   // Ensure QUICK_ADD_BUTTONS is always a valid array of numbers
   const QUICK_ADD_BUTTONS: number[] = Array.isArray(TIMER_CONFIG.quickAddButtons)

Based on past review comments.


348-355: Clamp totalSeconds to MAX_HOURS before conversion.

If a preset exceeds MAX_HOURS, this function will set hours beyond the allowed limit. This was flagged in previous review comments but remains unaddressed.

Apply this diff to clamp the value:

   const setAbsoluteTime = useCallback((totalSeconds: number) => {
     if (running) return;
+    const maxSeconds = (MAX_HOURS * 3600) + (59 * 60) + 59;
+    const clamped = Math.max(0, Math.min(totalSeconds, maxSeconds));
-    const { hours: h, minutes: m, seconds: s } = convertSecondsToTime(totalSeconds);
+    const { hours: h, minutes: m, seconds: s } = convertSecondsToTime(clamped);
     setLocalHours(h);
     setLocalMinutes(m);
     setLocalSeconds(s);
     syncTimeWithBackend(h, m, s);
-  }, [running, syncTimeWithBackend]);
+  }, [running, syncTimeWithBackend, MAX_HOURS]);

Based on past review comments.

🧹 Nitpick comments (2)
bigbluebutton-html5/imports/ui/components/timer/service.ts (1)

42-54: Consider removing or implementing the isActive field.

Line 52 always sets isActive: false for all presets. The field is included in the return type but never set to true. If this field is meant to indicate the current/active preset, implement the logic; otherwise, remove it to reduce confusion.

If you intend to mark the active preset, apply this diff:

   return visibleOffsets.map((offset) => {
     const idx = (currentIndex + offset + totalPresets) % totalPresets;
-    return { secs: presetSeconds[idx], isActive: false, idx };
+    return { secs: presetSeconds[idx], isActive: offset === 0, idx };
   });

Or remove the unused field:

-): Array<{ secs: number; isActive: boolean; idx: number }> => {
+): Array<{ secs: number; idx: number }> => {
   const totalPresets = presetSeconds.length;
   if (totalPresets === 0) return [];
   const visibleOffsets = Array.from({ length: visibleCount }, (_, i) => i);
   return visibleOffsets.map((offset) => {
     const idx = (currentIndex + offset + totalPresets) % totalPresets;
-    return { secs: presetSeconds[idx], isActive: false, idx };
+    return { secs: presetSeconds[idx], idx };
   });
 };
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (1)

449-490: Use component-level TIMER_CONFIG instead of re-reading config.

Line 450 re-reads window.meetingClientSettings.public.timer instead of using the TIMER_CONFIG already defined at line 193. This is inconsistent and could fail if config is missing.

Apply this diff:

   const timerMusicOptions = useMemo(() => {
-    const TIMER_CONFIG = window.meetingClientSettings.public.timer;
-    if (!TIMER_CONFIG.music.enabled) return null;
+    if (!TIMER_CONFIG?.music?.enabled) return null;
 
     return (
       // ... rest of JSX
     );
   }, [songTrack, stopwatch, running, handleMusicSwitchChange, intl]);

Also add TIMER_CONFIG to the dependencies:

-  }, [songTrack, stopwatch, running, handleMusicSwitchChange, intl]);
+  }, [songTrack, stopwatch, running, handleMusicSwitchChange, intl, TIMER_CONFIG]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65df31c and 3360789.

📒 Files selected for processing (2)
  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (8 hunks)
  • bigbluebutton-html5/imports/ui/components/timer/service.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-15T17:52:37.432Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/pt.json:323-323
Timestamp: 2025-10-15T17:52:37.432Z
Learning: Translation issues in locale files (bigbluebutton-html5/public/locales/*.json) should be updated in Transifex, the translation management platform used by the BigBlueButton project, rather than being fixed directly in pull requests.

Applied to files:

  • bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx
🧬 Code graph analysis (2)
bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (1)
bigbluebutton-html5/imports/ui/components/timer/service.ts (8)
  • addTimeWithBounds (180-194)
  • convertSecondsToTime (153-158)
  • getNextPresetIndex (21-23)
  • getPrevPresetIndex (31-33)
  • getVisiblePresets (42-54)
  • incrementTimeUnit (65-97)
  • decrementTimeUnit (107-146)
  • formatPresetLabel (6-13)
bigbluebutton-html5/imports/ui/components/timer/service.ts (1)
bigbluebutton-tests/playwright/user/util.js (1)
  • minutes (42-42)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-package (bbb-html5)
🔇 Additional comments (20)
bigbluebutton-html5/imports/ui/components/timer/service.ts (8)

21-23: LGTM!

The circular index calculation is correct.


31-33: LGTM!

The circular backward navigation correctly handles negative indices.


65-97: LGTM!

The overflow handling for all units is correct, and the maxHours boundary is properly enforced.


107-146: LGTM!

The underflow handling correctly cascades through units and floors at zero.


153-158: LGTM!

The conversion logic is correct.


167-169: LGTM!

The conversion logic is correct.


180-194: LGTM!

The bounds checking correctly limits to maxHours:59:59 and floors at zero.


6-13: Fix the zero-value check to format 0 correctly.

Line 7 returns an empty string when totalSeconds is 0, but zero is a valid duration that should format as "0:00:00". The condition !totalSeconds is truthy for 0.

Apply this diff:

 export const formatPresetLabel = (totalSeconds: number): string => {
-  if (!totalSeconds && totalSeconds !== 0) return '';
+  if (totalSeconds == null || Number.isNaN(totalSeconds)) return '';
   const hours = Math.floor(totalSeconds / 3600);
   const minutes = Math.floor((totalSeconds % 3600) / 60);
   const seconds = totalSeconds % 60;
   return `${hours}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
 };

Likely an incorrect or invalid review comment.

bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx (12)

202-211: LGTM!

The local state declarations correctly support the debounced sync pattern for time inputs.


224-230: LGTM!

The effect correctly synchronizes local UI state with server state when the timer is idle.


275-284: LGTM!

The hours input handler correctly updates local state immediately and syncs to backend on blur, avoiding excessive mutations.


286-305: LGTM!

The minutes overflow logic correctly carries over to hours and is properly clamped. The focus management enhances UX by showing the user where the overflow value went.


307-329: LGTM!

The seconds overflow logic correctly cascades through minutes to hours with proper clamping. This was addressed in commit 94434fb per past review comments.


331-346: LGTM!

The changeTime function correctly uses addTimeWithBounds to enforce limits and syncs immediately on button click.


360-368: LGTM!

The preset navigation correctly uses the circular index helpers from the service module.


373-399: LGTM!

The increment handler correctly debounces backend sync with a 1-second delay, avoiding excessive mutations during rapid clicks. This addresses previous review feedback.


401-426: LGTM!

The decrement handler mirrors the increment logic with proper debouncing.


533-545: LGTM!

The start handler correctly syncs local time to backend before starting, addressing previous review feedback.


601-639: LGTM!

The preset navigation UI has proper accessibility labels and correctly uses the service utilities for formatting and navigation.


640-783: Code structure for tab navigation appears correct, but manual testing is required to confirm the reported issue is resolved.

The tabIndex values are properly configured (0 when idle, -1 when running for inputs; -1 for arrow buttons), and no event handlers prevent default tab behavior. The blur handlers only sync time and don't interfere with focus flow. Parent containers and styled components have no focus-trapping CSS.

However, since PR feedback explicitly reports tab navigation is broken in version 3.1, manual verification is essential:

  1. Open the timer panel when not running
  2. Click into the hours input
  3. Press Tab key and confirm focus moves to the minutes input
  4. Press Tab again and confirm focus moves to the seconds input
  5. Verify Tab behavior works as expected in version 3.1

If tab navigation still fails despite correct tabIndex values, the issue may be at a parent container level (modal focus trap, wrapper restrictions) or related to the timer's running state management.

Comment on lines +786 to +820
{QUICK_ADD_BUTTONS.map((seconds) => {
const testId = `add${seconds}s`;
const timeLabel = seconds >= 60
? `${Math.floor(seconds / 60)} minute${Math.floor(seconds / 60) > 1 ? 's' : ''}`
: `${seconds} second${seconds > 1 ? 's' : ''}`;

// Generate time format label like humanizeSeconds but with + prefix
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
const formatNumber = (num: number) => (num < 10 ? `0${num}` : num.toString());

const displayLabel = hours > 0
? `+${formatNumber(hours)}:${formatNumber(minutes)}:${formatNumber(secs)}`
: `+${formatNumber(minutes)}:${formatNumber(secs)}`;

const tooltipMessage = intl.formatMessage(intlMessages.addTime, { time: timeLabel });

return (
<TooltipContainer
key={testId}
title={tooltipMessage}
>
<Styled.TimerAddButton
onClick={() => changeTime(seconds)}
disabled={running}
aria-label={tooltipMessage}
data-test={testId}
>
{displayLabel}
</Styled.TimerAddButton>
</TooltipContainer>
);
})}
</Styled.TimerAddsRow>

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.

⚠️ Potential issue | 🟡 Minor

Replace hardcoded English time units with intl messages.

Lines 788-790 hardcode English strings ("minute", "minutes", "second", "seconds"), which breaks localization for non-English users.

Define intl messages for these units:

// Add to intlMessages
minute: {
  id: 'app.timer.unit.minute',
  description: 'Singular: minute',
},
minutes: {
  id: 'app.timer.unit.minutes',
  description: 'Plural: minutes',
},
second: {
  id: 'app.timer.unit.second',
  description: 'Singular: second',
},
seconds: {
  id: 'app.timer.unit.seconds',
  description: 'Plural: seconds',
},

Then update lines 788-790:

                    const timeLabel = seconds >= 60
-                      ? `${Math.floor(seconds / 60)} minute${Math.floor(seconds / 60) > 1 ? 's' : ''}`
-                      : `${seconds} second${seconds > 1 ? 's' : ''}`;
+                      ? `${Math.floor(seconds / 60)} ${intl.formatMessage(
+                          Math.floor(seconds / 60) > 1 ? intlMessages.minutes : intlMessages.minute
+                        )}`
+                      : `${seconds} ${intl.formatMessage(
+                          seconds > 1 ? intlMessages.seconds : intlMessages.second
+                        )}`;

Alternatively, use a formatted message with count parameter for better i18n:

// In intlMessages:
addMinutes: {
  id: 'app.timer.addMinutes',
  description: 'Add {count} minute(s)',
},
addSeconds: {
  id: 'app.timer.addSeconds',
  description: 'Add {count} second(s)',
},

// In locale file:
"app.timer.addMinutes": "{count, plural, one {# minute} other {# minutes}}",
"app.timer.addSeconds": "{count, plural, one {# second} other {# seconds}}",

Then:

-                    const timeLabel = seconds >= 60
-                      ? `${Math.floor(seconds / 60)} minute${Math.floor(seconds / 60) > 1 ? 's' : ''}`
-                      : `${seconds} second${seconds > 1 ? 's' : ''}`;
+                    const timeLabel = seconds >= 60
+                      ? intl.formatMessage(intlMessages.addMinutes, { count: Math.floor(seconds / 60) })
+                      : intl.formatMessage(intlMessages.addSeconds, { count: seconds });
🤖 Prompt for AI Agents
In bigbluebutton-html5/imports/ui/components/timer/panel/component.tsx around
lines 786 to 820, the time unit strings ("minute(s)", "second(s)") are hardcoded
which breaks localization; replace those hardcoded strings by adding intl
messages for singular/plural (or pluralized messages that accept a count) to
intlMessages (e.g. minute/minutes or a pluralized addMinutes/addSeconds message)
and update the timeLabel construction to call intl.formatMessage with the
appropriate id and count so the correct translated singular/plural form is
returned; ensure intl (and intlMessages) is in scope where used and adjust any
tests/data-test expectations if needed.

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.

5 participants