GithubHelp home page GithubHelp logo

Comments (14)

nigelmegitt avatar nigelmegitt commented on May 28, 2024

By the way, I should add that this is on Chrome - it works fine on Firefox.

from imscjs.

palemieux avatar palemieux commented on May 28, 2024

It looks like this is a symptom of a bug in Chrome, which does not suppress white-space at the end of lines. As a result, the newline before the <br> is turned into a space, which is wrapped in an anonymous span with a transparent background. It is the latter to which line padding is applied.

from imscjs.

nigelmegitt avatar nigelmegitt commented on May 28, 2024

I understand, that certainly is unfortunate. Would you consider adding a workaround to "force" correct white space removal?

If you use jquery, something like the .trim() feature applied to each line might work, for example.

from imscjs.

davemevans avatar davemevans commented on May 28, 2024

Is there a crbug ticket for this issue?

from imscjs.

palemieux avatar palemieux commented on May 28, 2024

If you use jquery, something like the .trim() feature applied to each line might work, for example.

It is more complicated:

  • hiding the spaces can only happen after the line breaks are determined through inspection (since lines can wrap)
  • hiding the spaces can impact line wrap (in Chrome and Edge due to the bug)

... so this will need to be incorporated in the linePadding/multiRowAlign algorithm.

What would you day is the relative importance of this issue?

from imscjs.

palemieux avatar palemieux commented on May 28, 2024

@bbcrddave The thread at https://lists.w3.org/Archives/Public/www-style/2016Aug/0057.html implies that bugs would/should/could be filed.

from imscjs.

nigelmegitt avatar nigelmegitt commented on May 28, 2024

What would you day is the relative importance of this issue?

This is a tricky question to answer: relative to what? I would say that if linePadding is to be supported then it needs to be correctly supported, and it is something that I expect will be used.

Regarding the spaces impacting line wrap, if you know where the line wrap has been placed and that there is no manual break in the content, presumably you could in the script insert a <br/> so that any space trimming no longer affects the line breaks? And then trim trailing spaces.

from imscjs.

palemieux avatar palemieux commented on May 28, 2024

if you know where the line wrap has been placed and that there is no manual break in the content,
presumably you could in the script insert a
so that any space trimming no longer affects the line breaks?

Yes, as long as removing the offending whitespace in Chrome would have not caused lines to re-wrap, at which point the explicit <br/> are no longer accurate.

The linePadding algorithm, which inserts explicit <br/> accounting for the extra space taken by the padding, can likely be modified to address this Chrome bug. Modification of this algorithm however needs to be done carefully so that linePadding and multiRowAlign remain unaffected.

My plan is to first setup a robust test suite (see #29) and then address this kind of issues (with the safety net of a test suite to catch regression bugs) -- so the more tests the better at this point!

from imscjs.

davemevans avatar davemevans commented on May 28, 2024

Has there been any progress on this issue? I tried with Canary (60) and it is still a problem 😢

from imscjs.

palemieux avatar palemieux commented on May 28, 2024

@bbcrddave Yes, #29 has been closed, so we can hopefully make progress on this one. Do you have a set of canonical linePadding/multiRowAlign tests that you use?

from imscjs.

palemieux avatar palemieux commented on May 28, 2024

@bbcrddave Something that could be done in the short-term is remove all whitespace before all explicit <br> before processing multiRowAlign and linePadding. It might not address all corner cases, but would address the test case above. Thoughts?

from imscjs.

nigelmegitt avatar nigelmegitt commented on May 28, 2024

I haven't looked too hard at what it would take to create a bunch of canonical tests for this but they wouldn't really be about linePadding or multiRowAlign in themselves: rather they would be about the treatment of white space, since from #27 (comment) we can see that it is the presence of white space in particular locations that triggers the issue.

from imscjs.

palemieux avatar palemieux commented on May 28, 2024

@bbcrddave The PR at #40 should correct this defect by pruning all whitespaces immediately before and after explicit br elements. Looking forward to your review.

from imscjs.

davemevans avatar davemevans commented on May 28, 2024

Apologies for the slow response.
The proposed change solves the issue in Chrome and still works in Firefox - thanks!

from imscjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.