Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix for #11801: "Font Size" field on themes settings dialog could accept any characters #12830

Closed
wants to merge 1 commit into from

Conversation

geralexgr
Copy link

When the input field for font is not valid set the preferences in the default font size.

Copy link
Collaborator

@ficristo ficristo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem the right fix.
As suggested by @MiguelCastillo in the opening issue, have you tryed to add the pattern attribute to the html?
Something like pattern="^[\d\.]+(px|em)$"

@petetnt
Copy link
Collaborator

petetnt commented Oct 12, 2016

Thanks for contributing to Brackets @jerrak0s!

I think the pattern attribute could work, not sure if there's a premade size validation regexp though but the example @ficristo gave should be close enough after adding rems and so on.

@jerrak0s you can see the documentation on pattern here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-pattern

@geralexgr
Copy link
Author

geralexgr commented Oct 12, 2016

My intention was to fix the wrong value in the textfield Font Size: after wrong input.
So when i save something wrong in the font Size, that is not saved.

capture

@petetnt
Copy link
Collaborator

petetnt commented Oct 13, 2016

@jerrak0s Yup, and it's a good thing to do! With the pattern attribute however, you can ensure that users cannot write invalid values at all to the field 👍

@ficristo ficristo changed the title Fix for #11801 Fix for #11801: "Font Size" field on themes settings dialog could accept any characters Nov 1, 2016
@ficristo
Copy link
Collaborator

This needs more work. Closing for now.
The issue #11801 is still open.

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

Successfully merging this pull request may close these issues.

None yet

3 participants