question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Editor doesn't work in Safari when height or width is a percentage

See original GitHub issue

Problem

The editor works fine in Chrome, but doesn’t render properly in Safari. Looking at the resulting markup, it doesn’t even render the same way.

Here’s what the HTML for the gutter looks like in Safari:

<div class="ace_gutter">
  <div class="ace_layer ace_gutter-layer ace_folding-enabled" style="margin-top: -5px; height: 52px; width: 42px;">
    <div class="ace_gutter-cell " style="height: 19px;">3</div>
  </div>
  <div class="ace_gutter-active-line" style="top: -5px; height: 19px;"></div>
</div>

Here’s the same HTML for the gutter in Chrome:

<div class="ace_gutter">
  <div class="ace_layer ace_gutter-layer ace_folding-enabled" style="margin-top: 0px; height: 585px; width: 42px;">
    <div class="ace_gutter-cell " style="height: 19px;">1<span class="ace_fold-widget ace_start ace_open" style="height: 19px;"></span></div>
    <div class="ace_gutter-cell " style="height: 19px;">2</div>
    <div class="ace_gutter-cell " style="height: 19px;">3</div>
  </div>
  <div class="ace_gutter-active-line" style="top: 38px; height: 19px;"></div>
</div>

This makes it a lot harder to test out when using for accessibility on a Mac since VoiceOver only properly works with Safari, and VoiceOver is the main screen reader for a Mac.

Sample code to reproduce your issue

No special code sample necessary, just load the demo in both Chrome and Safari (http://securingsincity.github.io/react-ace/)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
kavinkcommented, Dec 20, 2017

@backwardok What’s not working for me is the react component , “width” does not not take percentage , just takes eg “500px” . I have not figured how to scale and fit to container .

2reactions
confiant-mfbcommented, Aug 6, 2019

As of today, react-ace will still not render if any flavor of ‘%’ is put into width or height, and will not scale to fit the parent properly. Edit: However, I was able to get it to work properly by setting the height and width to “auto”, and then making the parent force a flex.

Read more comments on GitHub >

github_iconTop Results From Across the Web

height:100% works in Chrome but not in Safari - Stack Overflow
The parent of an element with a percentage height must have a defined height and it must be with the height property.
Read more >
Why Percentage-Based Designs Don't Work in Every Browser
According to the spec, browsers, given a percentage width, would simply render the width of the page based on the size of the...
Read more >
How to Fix CSS Issues on Safari - W3docs
To make it work on Safari, we must set the appearance property to its "none" ... height: 100px; width: 17%; background: #ccc; border:...
Read more >
Resize, rotate, or flip an image in Preview on Mac
Resize the image by a percentage: Choose “percent” from the pop-up menu next to the Width and Height fields, then enter the percentage...
Read more >
Fix the height of the Editor in Iframe mode in Safari
The issue stems from the Iframe support of the Safari browser and especially when the height is set in percentage. The solution is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found