Questions tagged [stack-snippets]
Stack Snippets are runnable code sandboxes of the front-end languages HTML, CSS, and JS for use within a Stack Exchange post. Use this tag for bug reports, feature requests, and discussions explicitly relevant to these snippets and their underlying technologies.
143
questions with no upvoted or accepted answers
8
votes
0
answers
90
views
In the revision view the code snippet runs old code
In case someone posts a bad snippet and he or someone else fixes the code, the snippet runner in the revision view will play the old code.
Basically it will run the red and stroked code anyway. This ...
7
votes
0
answers
89
views
Stack snippets external file validation needs to be fixed
I went to edit a question that was linking to Google Fonts with http://fonts.googleapis.com/css?family=Poppins:400,300,500,600,700 and when clicking the "Add an external library" the snippet ...
7
votes
0
answers
285
views
Using CKEditor in a code snippet results in an error
Was trying to write a snippet to demonstrate something with ckeditor today and encountered this message:
{
"message": "SecurityError: Permission denied to access property \"document\" on cross-...
7
votes
0
answers
167
views
Correct Line Numbers for error messages in snippets
I try to write a working snippet in as many answers as possible. I find one of the hardest parts is tracking down bugs because the console messages show line numbers that don't match the snippet ...
7
votes
0
answers
59
views
Stack snippet indentation - preview differs from result
Today I encountered a code snippet whose preview renders fine during editing but with unwanted indentation after submitting:
arr1 = [{
Title: "xXx: Return of Xander Cage",
...
7
votes
0
answers
58
views
Add Stack Snippet (Code Snippet) Documentation to Help Center and/or Editing Help
I saw the new code snippet feature on the site and wanted to create one in an answer, but didn't see how. I expected to find the answer in the Editing Help, but didn't, so I went to the Help Center ...
7
votes
1
answer
158
views
Error in Stack Snippets console has incorrect lineno and colno
When there is an error in the JavaScript code in a Stack Snippet:
asoidf
I find the error message quite unhelpful.
Error: {
"message": "ReferenceError: asoidf is not defined",
"...
6
votes
0
answers
63
views
Moderator Redaction flags does not display collapsed code snippets
The moderator redaction tool does not display the redacted diff if the redacted bit was in a collapsed code snippet, so we cannot see what was redacted for approval. There aren't any buttons to expand ...
6
votes
0
answers
51
views
"Show code snippet" underline looks buggy
The link shows broken underline in some zoom levels.
Post taken from this answer and I am using Firefox 79.0.
6
votes
0
answers
88
views
Stack snippet with React and other npm libraries
I read through this great answer that shows how to create a stack snippet with React and JSX in it, but of course I want more. I'm currently working on a project that uses React and other libraries ...
6
votes
0
answers
71
views
Snippet interface top padding
I'd seen snippet interface is updated and it looks good. But in case of snippet editor there is padding on each editor box it's really annoying.
It can be seen in the above image before the line ...
6
votes
0
answers
147
views
Copy stack snippet from jsfiddle
If the original poster creates their snippet on jsfiddle, I'll usually tweak it there until I get it working. But when I want to post an answer, I usually prefer to use a Stack Snippet. So I have to ...
6
votes
0
answers
132
views
Stack Snippet comments not showing up correctly when part of code
I'm trying add a "stack snippet starter pack" for tag wikis for specific libraries so there's a ready-to-go template when adding a tag that a user (or answerer) could copy and paste into their ...
6
votes
0
answers
199
views
Add resources to code snippet
The amazing Stack Snippet is intended for javascript, css, html and related libraries/frameworks. I love it.
But suppose you try to make an AJAX request, or an ng-include for instance. As the tool is ...
5
votes
0
answers
129
views
Show a warning when on Stack Snippets throwing errors
Tl;Dr: Make use of the Ask question warnings to reduce the misuse of Stack Snippets. Automatically run it in the background when the user click the "Review your questions button", if there ...
5
votes
0
answers
71
views
Full screen snippets has an incorrect z-index in post revisions
Example post with a snippet https://stackoverflow.com/posts/71191950/revisions
Click "Run code snippet" and then click the "Full page" link
The top bar, side bar, and post ...
5
votes
0
answers
103
views
Why does the Stack snippets console error not show the correct line number?
When there is an error in a Stack snippet JavaScript code, an error message is displayed, but the "lineno" in the message is incorrect.
In the following snippet, it Shows the error is on ...
5
votes
0
answers
171
views
Auto-save for Stack Overflow code-snippets (Stack Snippets)
I was editing a Stack Snippet and the page froze and I lost all my work (it was a lot).
Could there be some kind of autosave when editing code snippets? (the ones with HTML, CSS, and JS that you can ...
5
votes
0
answers
111
views
Bug (?) with stack-snippets within three backticks
First off: I'm not sure if that's actually a bug. Just seemed really odd.
I was reviewing some suggested edits and came across the following edit (which I rejected):
Then I decided to view the ...
5
votes
0
answers
106
views
Can't post edit with NULL (U+0000) character in Stack Snippet
When a Stack Snippet contains a NULL (U+0000) character in its body, various errors start to arise:
Automatic POST requests to /posts/validate-body return a 418 No Reason Phrase error.
Trying to run ...
5
votes
0
answers
74
views
Stack Snippets don't allow opening new tabs/windows
From this answer of mine. The code works well on jsfiddle, but doesn't work on the Stackoverflow's snippet. By "works" I mean I want it to open https://www.google.com/ on a new tag, which is what the ...
5
votes
0
answers
168
views
Prompt new users to try Stack Snippets
I've been using SO for a fair while now and only just learned today about how to make Stack Snippets. My initial impression was that code entered into a message/post would automatically become a ...
5
votes
0
answers
210
views
Snippet with react-router-dom routing
I'm trying to run this snippet here on Stack Overflow.
I'm using react-router-dom from a CDN. I'm able to match the first route, but somehow I can't change to a different route.
Is it possible to ...
5
votes
0
answers
275
views
Missing referer header in Chrome when using code snippet
I created an answer for HERE maps autocomplete API on Stack Overflow and I'm having an issue with the HTTP_REFERER header not being sent when using Chrome browser (works fine w/ Edge and IE).
This ...
5
votes
0
answers
378
views
Stack Overflow snippet "begin snippet" purpose
Stack snippets have three parameters:
begin snippet
hide
babel
hide hides the snippet so it doesn't take up too much space, babel probably does something complicated that I don't understand, but ...
5
votes
0
answers
220
views
Stack snippets above a linked answer push the answer out of view
Not sure how butt-burningly important this is but I've noticed that if you click on a linked answer such as mine then the Stack Snippeted answers above the linked answer end up pushing the linked ...
5
votes
0
answers
54
views
Using Tidy on JSX produces incorrectly formatted code
I'm active in the reactjs tag and really like the ability to create runnable React snippets with the Use BabelJS/ES2015 option.
However, when tidy is run on a snippet containing JSX code it produces ...
5
votes
0
answers
65
views
Stack-snippets editor vs standard editor
When asking/answering questions there is often an issue when indenting code thats not necessarily runnable in the standard editor. Pressing the tab key simply tabs to the next control on the form.
...
5
votes
0
answers
70
views
Missing Close Button Due to z-index Issue
The stack snippets close button is missing after clicking "Full page". It appears to be an issue with the z-index. The iframe for the stack snippet has an inlined z-index: 1030, but the close button ...
5
votes
0
answers
182
views
Add a "Run code snippet" button to a Full Page snippet
The feature request is ultimately very similar to Can the "Full Page" button for code snippets be made to rerun the code?. However, that question has not seen much activity for a year, so I'...
5
votes
0
answers
78
views
Preview in list items is off
In the SO editor, the preview for various types of text inside list items does not match the end results.
Take this for instance. It is fine on the screen now, but when you edit...
This is a normal ...
5
votes
0
answers
72
views
Code Snippets and touch devices - how?
I always use a touch device with a large screen. I added a code snippet this week for the first time without problems.
Today I get the Code snippets not available on touch devices message, so I ...
5
votes
0
answers
172
views
Code snippet 'external library' is stacking files backwards
When using the 'external library' function in Code Snippets, the files are stacking up backwards, where the last file is placed on top of the previous one. The JavaScript framework pulldowns do the ...
4
votes
0
answers
61
views
Code Snippet - want to copy content with Shortcut CTRL-C (for external use)
Copying the code from the code snipptes is really annoying to select the right part of code (especially with long code parts with scrollbars) so it would be very helpful to have a shortcut like the ...
4
votes
0
answers
49
views
Non-executable code snippets with custom text beside the drop down arrow
Background
A lot of the time I will have code that is relevant towards solving a problem, but including it with my question tends to make the question look cluttered. This is really common when ...
4
votes
0
answers
35
views
Alert question status change inside code snippet
Every now and then, I've been frustrated when encountering a close questions after I finish writing a code snippet.
I've been coding inside a code snippet, trying to solve x problem. I finallly ...
4
votes
0
answers
152
views
Security error when executing same snippet more than one time
Today I noticed an error on one snippet saying
Error : Error executing AG js: SecurityError: Failed to read the 'sessionStorage' property from 'Window': The document is sandboxed and lacks the 'allow-...
4
votes
0
answers
77
views
Can we make parts of snippets collapsible?
I was taking a look at this question. As the OP originally had it, they included the relevant JavaScript, and had a JS Fiddle to execute the code.
Subsequently, an edit was made that removed the ...
4
votes
0
answers
60
views
Add CDN links for libraries in tags wikis, which can be options to add into stack snippets
For JavaScript and CSS libraries that have tags, CDN links could be added to the tag wiki for different versions of the libraries (I'm assuming the wiki is the best place).
Then, when a code snippet ...
4
votes
0
answers
82
views
Code snippet overflows container
The code snippet in HTML horizontal image scroll not working causes the viewport to expand wildly in iOS Safari (iOS 9.1)
4
votes
0
answers
78
views
Why do code snippets need cookies?
Testing the answer to question that involves cookies and should behave differently if cookies are disabled, I just found out something weird:
When you disable cookies, code snippets won't work any ...
4
votes
0
answers
995
views
Code snippet not working in Google Chrome
I keep creating answers to things and using the very hand code snippet function. The problem is that the snippets don't run in Google Chrome and throw this error in console:
The XSS Auditor refused ...
4
votes
0
answers
44
views
More libraries in snippets
Could there be more libraries build-in in the snippets editor?
Maybe there are some CDN's (like https://cdnjs.com ) who have an API or wants to make some deal with SO. Then you could add a search-box ...
4
votes
0
answers
127
views
Lorem ipsum generator tag in Stack Snippets
I provided an answer today where it would be helpful to fill up my Demo snippet with a bunch of paragraphs of dummy text. The page contents affects the behaviour of the demo and this can be ...
4
votes
0
answers
128
views
Make Stack Snippets more visible and encourage their use
A lot of people (especially new users) don't know about this feature.
It would help us a lot if the OP would use the snippet in his question. Answering time can be radically reduced.
Now, I see that ...
3
votes
0
answers
109
views
Add "Edit snippet" to snippets in an answer
Sometimes there're several snippets in an answer. It's very confusing/difficult to edit them in that case. Usually you look at a snippet you want to edit. Then you click 'Edit' for the answer it ...
3
votes
0
answers
54
views
Add toggle line wrap in snippet editor
I pasted a really long line of code into the snippet editor—so long that the editor decided to ignore the rest of it. Here you can see that it has overflowed to the next line (for some reason, there's ...
3
votes
0
answers
78
views
Close button when trying snippets on full screen might not be noticable
On my recent question, since I was trying the stack overflow snippet in full screen for the first time I couldn't notice that there was a close button on the top right corner, and that would be the ...
3
votes
0
answers
51
views
Code snippets feel inconsistent
Could we combine "Expand snippet" and "Full page" into a single and consistent experience?
If not then at least improve the general wonkiness?
Expand snippet
I can run code in ...
3
votes
0
answers
94
views
Is indentation in answer editor broken?
I edited this answer, and by the look of the things, I cannot understand what went wrong. The code is indented with spaces, but they somehow disappear in preview.
What did I do wrong?
(It's very ...