Fix TypeError in tabs.js for non-scrollable Translate tabs#38
Open
buzkall wants to merge 1 commit intosolutionforest:3.xfrom
Open
Fix TypeError in tabs.js for non-scrollable Translate tabs#38buzkall wants to merge 1 commit intosolutionforest:3.xfrom
buzkall wants to merge 1 commit intosolutionforest:3.xfrom
Conversation
The Translate component loads Filament's tabsSchemaComponent without passing isScrollable, which defaults to false. This triggers the dropdown overflow logic in tabs.js that expects a dropdown trigger element (.fi-tabs-item:last-child with .fi-icon), but the Translate template never renders this markup — causing: TypeError: Cannot read properties of null (reading 'clientWidth') Pass isScrollable: true to skip the dropdown logic, which is not needed for locale tabs.
There was a problem hiding this comment.
Pull request overview
This PR addresses a client-side crash in Filament 5 tabs initialization when the Translate form component renders non-scrollable tabs markup that lacks Filament’s dropdown-trigger element expected by the tabsSchemaComponent overflow logic.
Changes:
- Pass
isScrollable: trueinto Filament’stabsSchemaComponentAlpine initializer for the Translate component. - Avoid triggering the non-scrollable “tabs within dropdown” overflow logic path that was causing a
nulldereference.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using the Translate component on a Filament 5 page, the browser console throws:
Root Cause
The
translate.blade.phptemplate loads Filament'stabsSchemaComponentAlpine component without passingisScrollable, which defaults tofalse. This triggers the non-scrollable dropdown overflow logic intabs.js, which expects a dropdown trigger element (.fi-tabs-item:last-childcontaining a.fi-icon) to be present in the DOM.However, the Translate component renders tabs using
<x-filament::tabs>(the presentation component) which does not include the dropdown trigger markup that Filament 5's nativetabs.blade.phpschema component renders (lines 167-209). WhenupdateTabsWithinDropdown()runs,triggerEl.querySelector('.fi-icon')returnsnull, causing the crash.Fix
Pass
isScrollable: truetotabsSchemaComponentin the Alpine data. This skips the dropdown overflow logic entirely, which is appropriate since locale/translation tabs are always a small fixed set and don't need responsive overflow handling.