Skip to content

[Backport] [4.1] open-questions page#3945

Open
d0ubIeU wants to merge 1 commit intothorsten:4.1from
d0ubIeU:4.1_OpenQuestions_Backport
Open

[Backport] [4.1] open-questions page#3945
d0ubIeU wants to merge 1 commit intothorsten:4.1from
d0ubIeU:4.1_OpenQuestions_Backport

Conversation

@d0ubIeU
Copy link
Contributor

@d0ubIeU d0ubIeU commented Feb 5, 2026

This is a backport of the improvements recently merged into #main (4.2) for the open-questions page. The implementation has been adapted to match the architecture of version 4.1

Key Improvements:
Accessibility: Added semantic HTML5 table structure (thead, tbody, caption) and conditional ARIA attributes (aria-describedby) for better screen reader support.
Responsive Design: Replaced squashed tables on small screens with a modern card-based mobile view.
Logic Fix: Updated the permission check to properly include guests if records.allowNewFaqsForGuests is enabled.
UI/UX: Aligned the visual style (shadows, icons, and layout) with the start page for a consistent user experience.
High Contrast Mode: Fixed layout issues (empty columns) that previously disturbed the display in high contrast and dark modes.

Changes in this PR:
Modified open-questions.php to pass the correct boolean values to Twig.
Updated open-questions.twig with the new responsive and accessible structure.
Updated language files (en and de) to include or adjust variables like msgQuestion2 to reflect the combined "Category / Question" column.

Reference:
Backport of [#3941]

Summary by CodeRabbit

  • New Features

    • Introduced responsive card-based layout for open questions on mobile devices alongside desktop table view
    • Added permission-based conditional action buttons for answering or closing questions
  • Improvements

    • Enhanced accessibility with aria labels and semantic markup
    • Expanded user permission paths for answering questions
    • Added empty-state messaging and informational banner for unanswered questions
    • Updated question labels to include category context
  • Localization

    • Updated German and English translations for improved clarity

backport of the improvements recently merged into #main (4.2) for the open-questions page.
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

The open-questions section is enhanced with accessibility features, responsive design (desktop table vs mobile card layout), permission-driven UI logic for displaying action columns, and conditional action buttons. Supporting controller logic expands permission conditions and template variables, while German and English translations are updated accordingly.

Changes

Cohort / File(s) Summary
Template Responsive & Accessibility Refactor
phpmyfaq/assets/templates/default/open-questions.twig
Restructures layout for desktop (table with responsive wrapper, colgroup, caption) and mobile (card-based layout). Adds aria-labelledby/id accessibility attributes, permission-driven action column visibility, conditional action buttons (answer or FAQ), and empty-state/waiting-questions messaging.
Controller Permission & Variable Updates
phpmyfaq/open-questions.php
Expands userHasPermissionToAnswer to include FAQ_ADD permission or allowNewFaqsForGuests condition. Adds msgEmailTo template variable for translation key.
Translation Updates
phpmyfaq/translations/language_de.php, phpmyfaq/translations/language_en.php
Updates msgQuestion2 label to include category context ("Kategorie / Frage" / "Category / Question"). Adds new translation entry msgEmailTo ("E-Mail an" / "Email to").

Sequence Diagram

sequenceDiagram
    participant User as User/Browser
    participant Controller as Controller<br/>(open-questions.php)
    participant Template as Template<br/>(open-questions.twig)
    participant Renderer as Browser Renderer

    User->>Controller: Request open-questions page
    Controller->>Controller: Evaluate permissions<br/>(FAQ_ADD or allowNewFaqsForGuests)
    Controller->>Controller: Set userHasPermissionToAnswer flag
    Controller->>Controller: Prepare template variables<br/>(openQuestions, showActionColumn, etc.)
    Controller->>Template: Render with permissions & data
    
    Template->>Template: Detect device type<br/>(mobile vs desktop)
    
    alt Desktop View
        Template->>Template: Render table with colgroup<br/>and conditional action column
        Template->>Template: Add aria-labelledby attributes
    else Mobile View
        Template->>Template: Render card-based layout<br/>for each question
    end
    
    Template->>Template: Conditionally render action buttons<br/>based on permissions & answerId
    Template->>Template: Render empty-state or<br/>waiting-questions banner if needed
    
    Template->>Renderer: Return rendered HTML
    Renderer->>User: Display page to user
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #3941: Directly implements the same responsive/accessibility rework of open-questions template, permission logic expansion in controller, and translation updates across German and English language files.

Suggested labels

Improvement

Poem

🐰 Hops through the code with glee,
Responsive cards for all to see,
Permissions checked with care so bright,
Mobile and desktop—both just right!
Accessibility shines, a rabbit's delight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[Backport] [4.1] open-questions page' clearly and specifically describes the main change: backporting open-questions page improvements from main (4.2) to the 4.1 branch, matching the changeset's focus on updating that template and controller.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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.

@thorsten
Copy link
Owner

thorsten commented Feb 5, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

2 participants