When the tab title is in Chinese, the Form Tab is not separated correctly.
Package
filament/filament
Package Version
V3.2.0
Laravel Version
v11
Livewire Version
No response
PHP Version
PHP 8.3
Problem description
When I have two tabs in the form, if both tabs have Chinese titles, then their contents are merged into one, and both tabs are in a selected state.
Expected behavior
When using tabs, Chinese characters should be handled correctly.
Steps to reproduce
Tabs\Tab::make(__('基本信息'))->schema([
TextInput::make('title')
->label(__('Post Title'))
->required()
->maxLength(255)
->live(onBlur: true)]),
Tabs\Tab::make(__('(E)扩展信息'))->schema([
Placeholder::make(__('扩展信息')),
Hidden::make('user_id')
->default(auth()->user()->id)
->required(),
Hidden::make('post_type')
->default('post')
->required()])
When I use the above code, the error occurs. If I change it to the following code, the result is correct.
Tabs\Tab::make(__('Title '))->schema([
TextInput::make('title')
->label(__('Post Title'))
->required()
->maxLength(255)
->live(onBlur: true)]),
Tabs\Tab::make(__('Other Info '))->schema([
Placeholder::make(__('扩展信息')),
Hidden::make('user_id')
->default(auth()->user()->id)
->required(),
Hidden::make('post_type')
->default('post')
->required()])
Reproduction repository (issue will be closed if this is not valid)
https://github.com/cityisempty/filament-issue
Relevant log output
No response
Donate 💰 to fund this issue
- You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
- 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
- Thank you in advance for helping us make maintenance sustainable!
The issue comes from forms/src/Components/Tabs/Tab.php infolists/src/Components/Tabs/Tab.php
final public function __construct(string $label)
{
$this->label($label);
$this->id(Str::slug($label));
}
Str::slug($title, $separator = '-', $language = 'en', $dictionary = ['@' => 'at'])
The language parameter defaults to en, and when encountering Chinese characters, it results in an empty string.
I recommend modifying it to:
$this->id(Str::slug(Str::transliterate($label, strict: true)));
@zxc88645 Would you mind submitting a PR for this please?