Sometimes one can find a question or an answer containing a lot of typos and/or grammar errors: is it ok to proceed in correcting them (at the best of one's knowledge) or is it better to leave a comment to the author and suggest them to correct the post?
Yes, that's absolutely fine and encouraged. Edits to fix grammar and typos help the entire community. From our editing help article:
When should I edit posts?
Any time you see a post that needs improvement and are inclined to suggest an edit, you are welcome to do so. The original author of a question or answer may always edit their own post, regardless of reputation level.
Edits are expected to be substantial and to leave the post better than you found it. Common reasons for edits include:
- To fix grammar and spelling mistakes
- To clarify the meaning of the post (without changing that meaning)
(The list continues but these are the important bits here.)
Fixing mistakes in the post is great! By doing so you also help make the post clearer and more legible. You may also rephrase in the process if it assists with clarity; some edits I've done have considerably restructured the post.
The times I'll leave a comment instead of fixing an error myself are mainly those times I'm not sure how to fix it: part of a sentence is semantically meaningless or can mean several different things. I'll improve what I can, then draw the author's attention to that bit and ask them to clarify for us.
If they're having trouble communicating with us, for example if their English skill is limited and they probably won't be able to fix the sentence themselves, I might ask a pointed question or two in my comment that will resolve the ambiguity for me and then edit the post to resolve that error I left.
As long as you don't fix factual errors and tone
I wholeheartedly agree with doppelgreener, fix away what makes the answer more readable.
But don't alter the following to preserve the integrity of the answer:
- Choice of examples
Bad examples that just don't work or wrong conclusions are the substance of the post, which is changing the meaning. If the question would require listing some examples of different types of pants, and the examples are all examples of the same type of plant (like, all of them are tomatos), then changing the examples is changing the substance.
A bad example might be fixed, but if that would mean you rewrite the whole answer: Instead, write a better answer and vote!