-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Interactive forms: render button widget annotations (checkboxes and radio buttons) #7898
Interactive forms: render button widget annotations (checkboxes and radio buttons) #7898
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
} | ||
this.container.appendChild(inputElement); | ||
|
||
var labelElement = document.createElement('label'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment that will say that label will be visible as CSS styling will take care of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in the new commit.
return Promise.resolve(operatorList); | ||
} | ||
|
||
if (this.appearance) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a TODO since we need to select AS based on value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already taken care of by the getDefaultAppearance
function based on the AS
dictionary entry. Refactoring this is already part of the tracking issue.
418123c
to
e3d7ac3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that https://bugzilla.mozilla.org/show_bug.cgi?id=418833 has now (finally) landed, most modern browsers should now support proper styling of Checkboxes and Radio buttons.
With that in mind: Would it be possible to use normal HTML elements, instead of the label
hacks used here, since I believe that that would simplify the HTML, CSS and JavaScript a great deal here?
Yes this would mean that these elements wouldn't look as nice in browsers without support for styling them, but given the simplicity of that implementation I'd greatly prefer the approach with proper form elements!
@@ -97,6 +99,66 @@ | |||
width: 115%; | |||
} | |||
|
|||
.annotationLayer .buttonWidgetAnnotation.checkBox label, | |||
.annotationLayer .buttonWidgetAnnotation.radioButton label { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm mistaken, most of these rules are the same as those used above in
pdf.js/web/annotation_layer_builder.css
Line 44 in e3d7ac3
.annotationLayer .textWidgetAnnotation input, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in the new commit.
@@ -75,6 +77,26 @@ | |||
padding-right: 0; | |||
} | |||
|
|||
.annotationLayer .buttonWidgetAnnotation.checkBox label, | |||
.annotationLayer .buttonWidgetAnnotation.radioButton label { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm mistaken, most of these rules are the same as those used above in https://github.com/timvandermeij/pdf.js/blob/e3d7ac3595cf4a0832ba60835a0302e9e117d6df/test/annotation_layer_test.css#L46, hence moving these rules there instead (with possible necessary overrides here) might make the code more readable and maintainable!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in the new commit.
66b0baa
to
bc5eac0
Compare
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/961fde53b838aef/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/961fde53b838aef/output.txt Total script time: 2.20 mins Published |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/a1d9b662179c431/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/d08f4fd63603922/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/d08f4fd63603922/output.txt Total script time: 25.85 mins
Image differences available at: http://107.22.172.223:8877/d08f4fd63603922/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/a1d9b662179c431/output.txt Total script time: 26.41 mins
Image differences available at: http://107.21.233.14:8877/a1d9b662179c431/reftest-analyzer.html#web=eq.log |
Do you mind reviewing this PR again @Snuffleupagus, in particular the last commit, to check if it's better this way? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Yury has already reviewed most of this, I've mainly skimmed through the total diff.
[...] in particular the last commit, to check if it's better this way?
Yes, I think it's much better this way! By directly using the proper elements, the code becomes a lot cleaner and easier to follow!
I've got just one remaining question, and please keep in mind that "no" is a perfectly valid answer:
I've not looked too closely at the individual commits (besides the last one). but would it be possible/useful to fold some the smaller commits together before landing?
Also, when landing this, don't forget to add a note in the tracking issue about the flags that this PR doesn't implement; i.e. NoToggleToOff
and RadiosInUnison
, see http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G11.2201104.
Moreover, ensure that the read-only state is respected and improve CSS names.
bc5eac0
to
050dc6c
Compare
…rding to the specification
050dc6c
to
d5412e1
Compare
…ve labels Modern browsers support styling radio buttons and checkboxes with CSS. This makes the implementation much easier, and the fallback for older browsers is still decent.
d5412e1
to
a428899
Compare
Thank you. I managed to reduce the commits I added from five to three. |
/botio makeref |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/59636db25c5db62/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/eb3ae5292f21648/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/eb3ae5292f21648/output.txt Total script time: 25.42 mins
|
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/59636db25c5db62/output.txt Total script time: 25.46 mins
|
I have updated the tracking issue with the remaining points. |
…-radiobutton Interactive forms: render button widget annotations (checkboxes and radio buttons)
Replaces #7664.
Fixes a part of #7613.
The reference tests do not display selection marks in fields only when checkbox/radio button styling is supported by the browser because the rasterizer cannot handle that. This is not a problem for landing this patch, but we will add it to the tracking issue when this is merged.