From f6099bb6eeea02c0e0eaf40d34297c8885097216 Mon Sep 17 00:00:00 2001 From: alisher372 Date: Mon, 24 Aug 2026 14:57:41 +0500 Subject: [PATCH 1/2] Fix: Table question's columns panel forces the whole page to scroll with many columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem When a `Table` question has enough columns to overflow the viewport (reproduced with 7 columns), reaching the last ones requires scrolling the whole page instead of just the columns panel. Because the panel is a Bootstrap dropdown menu, scrolling the page while it stays open can make it jump back to the top instead of staying anchored to its toggle button, making it effectively impossible to configure columns past a certain point. ## Fix Give the columns container its own scroll (`max-height: 60vh; overflow-y: auto`) instead of letting it grow past the viewport. The "Add column" button stays outside the scrollable area and is always visible. ## Testing Added a regression test (`TableQuestionAdminConfigRenderingTest`) asserting that the rendered admin template's columns container carries both `overflow-y: auto` and a `max-height` constraint — a bare `overflow-y: auto` with no height limit never actually scrolls, so both are checked together. --- CHANGELOG.md | 6 + .../question_types/table_config.html.twig | 1 + .../TableQuestionAdminConfigRenderingTest.php | 125 ++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 tests/Model/QuestionType/TableQuestionAdminConfigRenderingTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8111ba9..3398a33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Fixed + +- Fixed the `Table` question's columns configuration panel: with enough columns to overflow the viewport, reaching the last ones required scrolling the whole page, which could make the still-open dropdown menu jump back to the top instead of staying anchored to its toggle button. The panel now scrolls on its own + ## [1.3.0] - 2026-08-11 ### Changed diff --git a/templates/editor/question_types/table_config.html.twig b/templates/editor/question_types/table_config.html.twig index af9bb0c..d53a701 100644 --- a/templates/editor/question_types/table_config.html.twig +++ b/templates/editor/question_types/table_config.html.twig @@ -69,6 +69,7 @@
diff --git a/tests/Model/QuestionType/TableQuestionAdminConfigRenderingTest.php b/tests/Model/QuestionType/TableQuestionAdminConfigRenderingTest.php new file mode 100644 index 0000000..e588663 --- /dev/null +++ b/tests/Model/QuestionType/TableQuestionAdminConfigRenderingTest.php @@ -0,0 +1,125 @@ +type = new TableQuestion(); + $this->login(); + } + + public function testColumnsContainerScrollsOnItsOwnInsteadOfThePage(): void + { + $html = $this->renderConfig([ + $this->column('A', QuestionTypeShortText::class), + $this->column('B', QuestionTypeShortText::class), + ]); + + $crawler = new Crawler($html); + $container = $crawler->filter('[data-af-table-columns-container]')->first(); + + $this->assertGreaterThan( + 0, + $container->count(), + 'The columns configuration panel must be present in the rendered admin template.', + ); + + $style = (string) $container->attr('style'); + $this->assertStringContainsString( + 'overflow-y: auto', + $style, + 'The columns container must scroll on its own once it has enough columns, ' . + 'instead of forcing the whole page (and the still-open dropdown menu with it) to scroll.', + ); + $this->assertMatchesRegularExpression( + '/max-height\s*:\s*\d+(\.\d+)?(vh|px|rem|em)/', + $style, + 'A bare `overflow-y: auto` with no height constraint never actually scrolls.', + ); + } + + /** + * @param array $columns + */ + private function renderConfig(array $columns): string + { + $this->enableConfigurableItem($this->type); + + $builder = new FormBuilder('Admin config rendering form'); + $builder->addQuestion( + 'Table', + TableQuestion::class, + extra_data: json_encode(new TableQuestionConfig(columns: $columns)), + ); + $form = $this->createForm($builder); + + $question = Question::getById($this->getQuestionId($form, 'Table')); + + return $this->type->renderAdvancedConfigurationTemplate($question); + } + + /** + * @return array{name: string, question_type: string, required: bool, itemtype: string, pattern: string} + */ + private function column(string $name, string $fqcn): array + { + return [ + TableQuestionConfig::COL_NAME => $name, + TableQuestionConfig::COL_QUESTION_TYPE => $fqcn, + TableQuestionConfig::COL_REQUIRED => false, + TableQuestionConfig::COL_ITEMTYPE => '', + TableQuestionConfig::COL_PATTERN => '', + ]; + } +} From 0977c7a7e82bc8d9e6696dea5e77a4eedc8b2a8d Mon Sep 17 00:00:00 2001 From: UncleTomsCabi <81857979+UncleTomsCabi@users.noreply.github.com> Date: Thu, 27 Aug 2026 13:03:47 +0500 Subject: [PATCH 2/2] Update CHANGELOG.md Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3398a33..ca26133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed -- Fixed the `Table` question's columns configuration panel: with enough columns to overflow the viewport, reaching the last ones required scrolling the whole page, which could make the still-open dropdown menu jump back to the top instead of staying anchored to its toggle button. The panel now scrolls on its own +- Fixed the `Table` question's columns configuration panel forcing the whole page to scroll instead of scrolling on its own ## [1.3.0] - 2026-08-11