Skip to content
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

[BUG] <p>&nbsp;</p> does not create empty space from 3.0.0-beta.2 #1439

Open
mkucharski17 opened this issue Sep 6, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@mkucharski17
Copy link

mkucharski17 commented Sep 6, 2024

Describe the bug:
<p>&nbsp;</p> should create space, but starting from version 3.0.0-beta.2 it is ignored. It works properly in version 3.0.0-beta.1

HTML to reproduce the issue:
<p>Paragraph before nbsp<\p><p>&nbsp;<p/><p>Paragraph after nbsp<\p>

Html widget configuration:

        Html(
              data:
                  "<p>Paragraph before nbsp<\p><p>&nbsp;<p/><p>Paragraph after nbsp<\p>",
              style: {
                'p': Style(margin: Margins.all(0)),
              },
            ),

Expected behavior:
It should create empty space.

Screenshots:

Screen using version 3.0.0-beta.2 Screen using version 3.0.0-beta.1
bad_behavior good_behavior

Device details and Flutter/Dart/flutter_html versions:

Flutter 3.22.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 761747bfc5 (3 miesiące temu) • 2024-06-05 22:15:13 +0200
Engine • revision edd8546116
Tools • Dart 3.4.3 • DevTools 2.34.3
@mkucharski17 mkucharski17 added the bug Something isn't working label Sep 6, 2024
@mkucharski17 mkucharski17 changed the title [BUG] <p>&nbsp</p> does not create empty space from 3.0.0-beta.2 [BUG] <p>&nbsp</p> does not create empty space from 3.0.0-beta.2 Sep 6, 2024
@Albert221
Copy link

Currently the whitespace.dart file removes the &nbsp treating it as a whitespace, and then removes the now-empty p element:

tree = _processBlockWhitespace(tree);
tree = _removeEmptyElements(tree);

That's not consistent with how browsers treat such paragraphs. An empty paragraph with a non-breakable space is often used by WYSIWYG editors in CMSes for empty spaces.

@mkucharski17 mkucharski17 changed the title [BUG] <p>&nbsp</p> does not create empty space from 3.0.0-beta.2 [BUG] <p>&nbsp;</p> does not create empty space from 3.0.0-beta.2 Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants