Skip to content

Commit

Permalink
Stop using negative margins on Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelmegitt authored Dec 1, 2023
1 parent 32d0767 commit d672018
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/js/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* @module imscHTML
*/

var browserIsFirefox = /firefox/i.test(navigator.userAgent);

;
(function (imscHTML, imscNames, imscStyles) {

Expand Down Expand Up @@ -750,13 +752,20 @@
// End element
if (context.ipd === "lr") {

ee.node.style.marginRight = negpadpxlen;
// Firefox has a problem with line-breaking when a negative margin is applied.
// The positioning will be wrong but don't apply when on firefox.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1502610
if (!browserIsFirefox) {
ee.node.style.marginRight = negpadpxlen;
}
ee.node.style.paddingRight = pospadpxlen;

} else if (context.ipd === "rl") {

ee.node.style.paddingLeft = pospadpxlen;
ee.node.style.marginLeft = negpadpxlen;
if (!browserIsFirefox) {
ee.node.style.marginLeft = negpadpxlen;
}

} else if (context.ipd === "tb") {

Expand Down

0 comments on commit d672018

Please sign in to comment.