Bug description
The order of options returned by a dictionary is not preserved in the Control Panel. The dropdown shows them in a different order than the dictionary defines. This only seems to happen when the option keys/values are numbers, where they end up sorted ascending instead of keeping the dictionary's order.
Options defined in the dictionary:
protected function getItems(): array
{
return [
['id' => '123', 'description' => '123 Shoes'],
['id' => '1', 'description' => '1 Shirt'],
['id' => '7', 'description' => '7 Hats'],
['id' => '5', 'description' => '5 Pants'],
];
}
Options shown in the CP:
How to reproduce
- Clone repository: https://github.com/helloiamlukas/dictionary-options-wrong-order
- Open /cp/collections/articles/entries/7ac0bdda-1b84-45f8-ac52-2575dd7e8251
- Open the dropdown of the "Products" field
Logs
Environment
Environment
Laravel Version: 13.17.0
PHP Version: 8.3.22
Composer Version: 2.9.7
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file
Storage
public/storage: NOT LINKED
Statamic
Addons: 0
License Key: Not set
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.23.0 Solo
Installation
Starter Kit using via CLI
Additional details
No response
Bug description
The order of options returned by a dictionary is not preserved in the Control Panel. The dropdown shows them in a different order than the dictionary defines. This only seems to happen when the option keys/values are numbers, where they end up sorted ascending instead of keeping the dictionary's order.
Options defined in the dictionary:
Options shown in the CP:
How to reproduce
Logs
Environment
Installation
Starter Kit using via CLI
Additional details
No response