I had the opposite problem that was not easy to solve at first. In order to remove an attribute that has no value such as "readonly", "disabled", or "inert", setting it to "true" or "false" will actually activate it. Instead, specifying "@true" or "@false" such as "readonly=@true", "disabled=@false", or "inert=@false" will prevent the attribute from being generated.
https://blazor-university.com/components/code-generated-html-attributes/#special-cases