Skip to content

fix(richtext-lexical): order=0 being sorted to the end of the toolbar#17090

Open
beheh wants to merge 1 commit into
payloadcms:mainfrom
beheh:fix/toolbar-sort-order-zero
Open

fix(richtext-lexical): order=0 being sorted to the end of the toolbar#17090
beheh wants to merge 1 commit into
payloadcms:mainfrom
beheh:fix/toolbar-sort-order-zero

Conversation

@beheh

@beheh beheh commented Jun 23, 2026

Copy link
Copy Markdown

What?

The following lexical editor features.BlocksFeature config:

		BlocksFeature({
			blocks: [
				BoxBlockConfig,
				MediaImageBlockConfig,
				MediaVideoBlockConfig,
				CardImageBlockConfig,
				FloatClearBlockConfig,
				EmbedBlockConfig,
			],
			// ...
		})

...currently results in a mis-sorted dropdown:

Dropdown

...where my custom "BoxBlockConfig" is at the end.

Why?

Because the sorting component does not consider false-y orders valid, the item with the index 0 is incorrectly sorted to the end.

How?

Switching to an explicit non-null check keeps the defensiveness while fixing this:

Fixed Dropdown

@beheh beheh requested a review from AlessioGr as a code owner June 23, 2026 15:14
@beheh

beheh commented Jun 23, 2026

Copy link
Copy Markdown
Author

I've observed this @payloadcms/richtext-lexical@3.79.0 but have targeted main for now - not sure if you'll backport, or not, or if I should've opened against 3.X and this would've been ported to 4.X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant