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

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

Closed
backwardok opened this issue Jul 12, 2017 · 13 comments
Closed

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

backwardok opened this issue Jul 12, 2017 · 13 comments

Comments

@backwardok
Copy link

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/)

@securingsincity
Copy link
Owner

@backwardok I'm able to reproduce but I'm not sure what the cause is. This might be an issue with the Ace Library itself. I'll investigate further.

@securingsincity
Copy link
Owner

Interestingly @backwardok the split editor works http://securingsincity.github.io/react-ace/split.html so I wonder if this is an issue with one of the configurations of the demo.

@securingsincity
Copy link
Owner

So after doing some debugging the editor example works fine without the height="100%" which is interesting to say the least... I'm going to remove that from the example for now. Not sure what the issue really is here, might be Ace related

@backwardok
Copy link
Author

Weird! Hopefully that work around solves the problem we're seeing in our usage of it as well. Thanks for looking into that!

@securingsincity
Copy link
Owner

@backwardok no problem. Just because I'm curious, what kind of project are you using react-ace in?

@backwardok
Copy link
Author

@securingsincity we're using it for a playground within storybook to allow developers to play around with different react components that exist within our library.

@securingsincity securingsincity changed the title Editor doesn't work in Safari Editor doesn't work in Safari when height or width is a percentage Aug 3, 2017
@securingsincity
Copy link
Owner

Changing the title as this appears to be an issue unique to ace and setting the height and width to be a percentage.

@dmigo
Copy link

dmigo commented Aug 6, 2017

It seems to be working with ace in Safari and Chrome. Or am I doing something wrong?
Prove

@kavink
Copy link

kavink commented Dec 20, 2017

@dmigo Its not using the React component ? just ace.js ?

@backwardok
Copy link
Author

Not sure if the example changed since I created this, but it seems like the example is working in Safari?

@kavink
Copy link

kavink commented 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 .

@connorwaslo
Copy link

react-ace still seems to not be able to take a percentage for width or height.

@confiant-mfb
Copy link

confiant-mfb commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants