-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RichTextField with no block elements renders with unhelpful UI components #9706
Comments
Thank you for the report @dkirkham! This feels like a clear UX issue. I’m not too clear on what the right fix or fixes would be for this, and whether it qualifies as a bug or not. I agree with your plan on how to fix this, though am finding this a bit hard to reason about so any further input / feedback is very welcome. |
@thibaudcolas, is the issue my use case (ie. not wanting the block elements) being unreasonable, or is it deciding exactly how to present the UI in this circumstance? Since the issue doesn’t prevent any work being done, nor does it corrupt any data or cause a crash, I’m quite happy for this not to be classified as a bug, but instead as a feature request to clean up the UI. |
Your use case is spot on, it’s the "how to present the UI in this circumstance" I’m not sure what to do with. We’re currently reviewing our implementation of the rich text UX so we’ll be looking into this aspect of it too. I’d at least qualify it displaying "no results found" as a bug. If there are no items to display in the UI, I think I’d still prefer those UI elements to be there nonetheless, but if so they should have a separate "empty" state. |
Definitely an interesting one, so this happens when there aren't any blocks avaliable, but the user can select things like bold/italic/link via the floating formatting bar, which is shown if they select or double click on the text they've entered. My initial thoughts are that if there are no actions to be complete, then the user shouldn't be presented with the plus symbol. Currently this just results in a wasted click, and potential confusion due to the "no results" text. The slight downside of removing the plus icon, will be that if users are familiar with seeing it, they then maybe confused as to why it isn't showing. With this in mind I feel like updating the placeholder text to simply "Write something" instead of "Write something or type "/" to insert a block" when no blocks are avaliable, as well as not showing the plus symbol, would make it obvious to these users that this is intended. So to summarise, my suggestion would be for us to do the following when no blocks are avaliable:
|
This has been approved to be implemented in the future |
+1 |
Hi all, any progress on this? |
I’d like to see this happen but have other priorities for the time being. @shayan-oanda if you want to make a pull request please go for it. |
Hello, I tried to solve this issue, but I have absolutely no idea how to do a pull request and contribute (I have no programming background) I used the gitpod-wagtail-develop. // wagtail/client/src/components/Draftail/index.js - line 209
return {
// ...
placeholder:
blockTypes.length > 0
? gettext('Write something or type ‘/’ to insert a block')
: gettext('Write something'),
// ...
topToolbar: (props) => (
<>
{blockTypes.length > 0 ? (
<BlockToolbar
{...props}
triggerIcon={ADD_ICON}
triggerLabel={comboBoxTriggerLabel}
comboLabel={comboBoxLabel}
comboPlaceholder={comboBoxLabel}
noResultsText={gettext('No results')}
ComboBoxComponent={ComboBox}
/>
) : null}
<InlineToolbar
{...props}
pinButton={pinButton}
defaultToolbar={getSavedToolbar()}
onSetToolbar={onSetToolbar}
/>
</>
),
// ...
commandToolbar: (props) => (
blockTypes.length > 0 ? (
<CommandPalette
{...props}
noResultsText={gettext('No results')}
ComboBoxComponent={ComboBox}
/>
) : null,
// ...
}; Another solution : To demonstrate my solution, I modified a What do you think ? @thibaudcolas I think that another solution would be to change how |
@Zogsha thank you for giving this a go :) Yes, the code you wrote is more or less the idea. The check needs refinement and could get quite complex as there are other things than I’m impressed you got this far without a programming background! This specific area of Wagtail is quite hard to work on. |
RichTextField with no block elements renders with unhelpful UI components
This is more a cosmetic issue, than a bug per se. It might be more of a bug from an accessibility point of view.
When specifying a RichTextField without any block elements in the feature list, the widget still renders:
Both have the potentially confusing "No results" text in the menu because there are no block element types to list there.
Steps to Reproduce
text = RichTextField(features=['bold', 'italic', 'link'])
I consider this a bug, because when there are no block elements, the placeholder text, / and circle/plus elements should not be present. This requirement is very similar to the goals of #8249, however in my use case I still want to allow paragraphs and inline formatting; I just don't want headers, lists, etc.
Technical details
The text was updated successfully, but these errors were encountered: