Stop FormHelper from emitting inline validity handlers
CI / Deploy / PHP 8.5 (push) Successful in 1m7s
CI / Deploy / PHP 8.4 (push) Successful in 1m7s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped

Required fields got generated oninvalid/oninput attributes, which the CSP
blocks and logs on every page and when parsing dashboard fragments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-12 22:54:08 +01:00
1 parent ce2627d03a
commit 220227fa86
2 files changed
+4

No files matched your search

+2
View File
@@ -38,5 +38,7 @@ class AppView extends View
public function initialize(): void
{
$this->addHelper('Format');
// No generated oninvalid/oninput handlers: the CSP blocks inline event handlers.
$this->addHelper('Form', ['autoSetCustomValidity' => false]);
}
}
@@ -64,6 +64,8 @@ class AdminFragmentTest extends TestCase
$this->assertResponseNotContains('onclick=');
$this->assertResponseContains('data-confirm=');
// Required fields (settings form) must not get generated oninvalid/oninput handlers, the CSP blocks them.
$this->assertDoesNotMatchRegularExpression('/\son[a-z]+="/', (string)$this->_response->getBody());
}
public function testSlideFormFragmentIsTheDialogContent(): void