WordPress / better-code-editing

[✅ Merged into 4.9-alpha] Better Code Editing WordPress plugin
https://wordpress.org/plugins/better-code-editing/
37 stars 16 forks source link

Update button disabled on error. #95

Closed paaljoachim closed 6 years ago

paaljoachim commented 6 years ago

Hey

I installed the plugin and there seems to be an error in the style.css in a theme I have activated. It says "There is 1 error which must be fixed before you can save."

It would be better to give a soft alert in regards to errors but not turn off the Update File button. Give the user the control. So there is an error and it is up to the user to fix it. Let the user work around the error and gradually figure it out.

screen shot 2017-09-14 at 18 45 44 2

afercia commented 6 years ago

Looking at the theme demo site, I see one rule with a textfield property: [type="search"]{-webkit-appearance:textfield;outline-offset:-2px}

Interesting question: does CodeMirror supports vendors proprietary CSS properties and values? Fun 🙂

westonruter commented 6 years ago

@afercia This CSS is not the problem. It can still be saved if I paste it into another stylesheet. Warnings don't cause the save to be blocked:

image

@paaljoachim please scroll down to see if there is another error.

I think this highlights a needed enhancement and that is that the error notice should be extended to have a “Show me” button which scrolls the editor down to the line where the error occurs.

See conversation at https://wordpress.slack.com/archives/C0381N237/p1505407182000092

westonruter commented 6 years ago

The textarea value for -webkit-appearance was recently reported upstream in CSSLint: https://github.com/CSSLint/csslint/issues/713

paaljoachim commented 6 years ago

Btw the CSS is from the stylesheet of a Genesis child theme. They use a lot of compacted css in the beginning of their files so that it looks like it is minified.

I found the error almost in the bottom of the stylesheet. I had written ren instead of rem.

testing-better-code-editing-error-found

A gif of the full style.css: https://www.dropbox.com/s/dt5k6ojm6pub5nq/Testing-Better-Code-Editing-plugin.gif?dl=0

Here is the style.css: https://www.dropbox.com/s/u0iojbh5y64u86x/style.css?dl=0

There are mysterious messages such as: 6 of the following: "Using width with padding-left can sometimes make elements larger then you expect."

It makes me think of driving a car. Objects can be closer then what they appear to be.

I also got a warning beside border: 1px solid #ddd "Using width with border can sometimes make elements larger then you expect."

2 warnings in the following code. "Outlines should only be modified using :focus. and "Using width with padding can sometimes make elements larger then you expect."

.genesis-nav-menu .sub-menu a { background-color: #111; outline: none; padding: 20px; position: relative; width: 200px; }

Another example: .genesis-nav-menu a { color: #fff; display: box; / block / font-size: 14px; font-size: 1.4rem; font-weight: 200; letter-spacing: 1px; padding: 30px 15px; text-transform: uppercase; font-weight: bold; / Added / }

Beside font-weight: bold !Duplicate property 'font-weight' found. ---> Yeah a good alert. Then a very long warning message beside display: box. Basically with a lot of text saying that box is the wrong code to use.

westonruter commented 6 years ago

Moved to Trac: https://core.trac.wordpress.org/ticket/41886