Editor doesn't work in Safari when height or width is a percentage
See original GitHub issueProblem
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:
- Created 6 years ago
- Comments:13 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 .
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.