polymerelements / iron-collapse Goto Github PK
View Code? Open in Web Editor NEWAdds collapsible behavior to a target element
Home Page: https://www.webcomponents.org/element/PolymerElements/iron-collapse
Adds collapsible behavior to a target element
Home Page: https://www.webcomponents.org/element/PolymerElements/iron-collapse
I have the following snippet:
<iron-collapse id="input_box">
<div>
<paper-material elevation="2">
Text here
<paper-input label="Your input"></paper-input>
</paper-material>
</div>
</iron-collapse>
Invoking
this.$$('#input_box').show()
briefly animated the input_box
to open but it closed immediately after.
But, setting the opened
attribute worked perfectly (including the slide down animation)
this.$$('#input_box').opened = true
Enclosing a paper-card element which has its elevation property set to one of {0|1|2|3|4|5} inside of an iron-collapse results in the paper-card element losing its elevation property (effectively, elevation="0")
I tested the same with paper-material and in this case, the elevation was preserved.
The animation transition duration is static.
The animation transition duration should be configurable.
The animation transition duration is setted to 300ms.
Maybe it is not a good thing...
If you set the opened attribute to anything, it is interpreted as true.
e.g.,
<iron-collapse id="collapse" opened="false"> inside collapse </iron-collapse>
Still shows the content inside the collapse.
I tried to rebuild the demo in Dart Angular2 and the #collapse2
doesn't resize when #collapse3
is opened.
I could reproduce this in the JS demo when I initially remove the horizontal
attribute from #collapse3
and then add it just before I expand it.
This way it has an redundant height: 0px;
which breaks the demo.
It seems for the initial default "vertial" dimension the "height: 0px" is added but then when switched to "horizontal" it is not removed.
Looks like when using the element with Angular, the timing is somehow different which results in this behavior.
With VoiceOver / Chrome: When I use the keyboard and screen reader to expand the second item, then my focus goes to the expanded text for the first item. It should logically move to the expanded text for the item I just expanded though. This seems a little confusing for the user. The same thing happens when I expand the third item -- focus shifts back up to the second expanded blurb. Order seems strange. To try this out, enable VoiceOver on Mac by pressing command F5. Then press control + option + right arrow to try to navigate through in logical order.
This does NOT occur on Chrome OS with ChromeVox -- order seems logical with this screen reader / OS / browser combo. I will try this on Windows later this week to see what happens there.
However, as I navigate through with Chrome OS, it just tells me ""collapse button 1"" for example, no matter if it's collapsed or expanded. I think it would be helpful to announce the state -- whether it is collapsed or expanded. Is this possible?
This was originally opened in PolymerElements/paper-radio-button#55, and depends on Polymer/polymer#1773 landing.
TL: DR: If your children change, the size of the iron-collapse should also change
(Copied from Polymer/polymer#1760)
Illustrated by demo: https://elements.polymer-project.org/elements/iron-collapse?view=demo:demo/index.html
Clicking on the content inside core-collapse, or tabbing into it, produces an ugly "focused" outline (on Chrome, a glowing blue outline). In my opinion, this should not be the desired behavior. The element controlling the iron-collapse (e.g., a button) is the one that should be focusable, and the developer is the one that should be responsible for making sure that it is. Making the iron-collapse focusable doesn't achieve anything useful.
The hostAttributes
of iron-collapse has tabindex: 0
, which is causing this behavior. There's no way to remove the behavior. Even setting tabindex="-1"
in the iron-collapse element makes it focusable on click (strange, because it isn't tabbable).
core-collapse in v0.5 does not have this behavior; I'd say this a regression.
P.S. I'd love for this to be my first pull request/contribution to open source on GitHub, if you devs agree with me and would let me. ๐
An empty iron-collapse that gets opened won't show content loaded at a later time.
iron-collapse should show dynamically loaded content if opened
iron-collapse does not show anything (max-height: 0px)
https://jsbin.com/jekeyotiko/edit?html,output
iron-collapse
element in the page, opened with no content.I'm trying to use an animated iron-collapse with a padding-bottom on it, basically on toggle, the animation takes the padding into account and does a strange expand effect, which doesn't occur when noAnimation is set to true
iron-collapse incorrectly sets the aria-expanded attribute.
According to W3C aria-expanded should be set on the "triggering link or button".
iron-collapse is not the trigger link or button but rather the collapsible content itself.
Developers should set aria-expanded on the button that triggers the opening/closing of iron-collapse and it should not be set on iron-collapse itself.
When navigating into an iron-collapse region the screen reader should not indicate that the region is expanded.
When navigating into an expanded iron-collapse region the screen reader announces 'Expanded'.
I've only tested this on Chrome, but I suspect it applies everywhere a screen reader is used.
In certain flexbox environments iron-collapse
fails to visually collapse itself and to report transitionend
events. The flex
character suppresses the height
changes visually.
Visually collapsing iron-collapse
and fired transitionend
events.
No animation visible, content remains visible, no transitionend
events.
See failing test in timove@eec525b
Verified for, otherwise untested:
The accessibility developer tools audit results are:
"Warning] Text elements should have a reasonable contrast ratio (1)Not applicable tests (14)Passing tests (2)
IMO, the contrast here is totally fine. Black on light grey is fine.ย
That said, I am running into some issues with keyboard navigation (without a screen reader on). I can't seem to navigate and collapse / uncollapse the content with just the keyboard. I also don't have a clear visual focus state.
I tested this with VoiceOver on Mac and ChromeVox on Chrome OS. The latter seemed to work fine, but with VoiceOver, I wasn't able to access the uncollapsed text content. We should look into why this might be the case, specifically on this screen reader / browser combo.
Is there a way to make the iron-collapse open from right to left when using horizontal? It seems that it either opens top to down without horizontal, and then left to right with horizontal..
Kind of like putting in a dom-if, but of course we can't do that.
Is this feasible with a templatizer?
On Android with Talkback, right now, I don't have any sense for the state -- collapsed or expanded. When I double tap with Talkback, I just hear ""collapse #1"" each time, whether expanded or not. This context is missing for the user.
Please provide possibility of listening to "opened" and "closed" events
Event is called when animation is finished
If the page doesn't had enough content that it must scroll than after a toggle of the iron collapse it isn't possible to scroll.
You can scroll to see all content.
No Scrolling possible
Could you please restore on-collapse-open
event from 0.5 version of this component?
Thank you in advance
Attribute opened
is not removed when calling close()
.
Attribute opened
should be removed when iron-collapse
is closed.
Attribute opened
is still set after calling close()
.
Set reflectToAttribute: true
for property opened
:
opened: {
type: Boolean,
value: false,
notify: true,
observer: '_openedChanged',
reflectToAttribute: true // <-- Add this line
},
iron-collapse has a vertical scrollbar that only displays during its animation.
The effect can be seen here https://elements.polymer-project.org/elements/iron-collapse?view=demo:demo/index.html
paper-menu isn't migrated to polymer 2
when i type in console
bower install paper-menu#2.0-preview
it should be installed
bower paper-menu#2.0-preview ENORESTARGET Tag/branch 2.0-preview does not exist
indeed there is no tag
bower install paper-menu#2.0-preview
When I call updateSize("200px", true)
on an opened iron-collapse
, it will perform the animation to that value but then reset it to the full height.
The maxHeight
should be kept to 200px
maxHeight
is reset to ""
at the end of the transition.
http://jsbin.com/wovujur/2/edit?html,output
Click on change size button
All
paper-menu-button is invisible.
<paper-menu-button>
<paper-icon-button icon="my-icons:face" class="dropdown-trigger"></paper-icon-button>
<paper-menu class="dropdown-content">
<paper-item>Share</paper-item>
<paper-item>Settings</paper-item>
<paper-item>Help</paper-item>
</paper-menu>
</paper-menu-button>
Should display icon button.
Nothing is visible
http://jsbin.com/ledisij/edit?html,output
copy example from
https://www.webcomponents.org/element/PolymerElements/paper-menu-button
I want to set the overflow to hidden but no customizable property is available
I had this structure:
<template is="dom-if" if="{{...}}">
<button on-click="toggle">Text</button>
<iron-collapse id="myid">
<div>Test</div>
</iron-collapse>
</template>
....
toggle() {
this.$.myid.toggle();
}
And when I clicked the button which triggered the toggle function, I noticed that "myid" was not present in this.$
. Only after placing the iron-collapse
element outside of the if template did this work.
Is this by design?
The following line in iron-collapse.html is causing an error (stated below):
Line 204: iron-collapse.html
this.offsetHeight = this.offsetHeight
Error:
Uncaught TypeError: Cannot set property offsetHeight of #<HTMLElement> which has only a getter
Note that I am running the code through a transpiler because I have es6 code in my project.
Can you fix this?
Hello,
I was trying the demo on https://elements.polymer-project.org/elements/iron-collapse
But the collapse functionality it is not working.
Tried on Mozilla Firefox for Ubuntu canonical - 1.0 / version 37.0
This issue was filed in PolymerElements/iron-list#157
iron-collapse should use iron-resizable and call notifyResize
when the open
state changes.
The element continues to animate open and closed after calling enableTransition(false)
.
It looks like _openChanged() internally enables and disables transitions using this same method, and thus any previous enableTransition() setting is clobbered, as it is not persisted anywhere else beyond the transitionDuration style property.
Is there any way to substitute core-resize event if open-changed is not enogh?
Programmatically expanding (show()
) a hidden submenu puts it in a buggy state, where opened
is true
but the CSS height
is 0px
.
This is due to a bug in the animation code, and therefore only manifests if the submenu has animations turned on (which is the default).
http://jsbin.com/rutakeciri/edit?html,output
show()
on the closed iron-collapse
nested under a closed top-level iron-collapse
).iron-collapse
.The top-level iron-collapse
opens and reveals an open nested iron-collapse
.
The top-level iron-collapse
opens and reveals an apparently closed nested iron-collapse
. (In fact its opened
is true
but its height
is 0
.
Clicking on the nested iron-collapse
seemingly does nothing (in fact it sets opened
to false
).
Clicking it again reveals it as expected.
This is due to the way the animation code tries to calculate the target height by setting the desired style and calling getBoundingClientRect
. Unfortunately when the element is nested under a hidden parent menu (display: none
), gBCR returns 0 as height.
See #49 for a fix.
Note that I've encountered this issue when using paper-menu
(which uses iron-collapse
internally).
When compiled/vulcanized, iron-collapse won't animate properly, because these lines gets removed
...
// Force layout to ensure transition will go.
/** @suppress {suspiciousCode} */ this.offsetHeight;
...
I have a trouble with using component.
Collapse content should be expanded
When i click the button its throws a error.
Here is my html template:
<template is="dom-repeat" items="[[items]]">
<div class="collapse-container">
<button on-click="toggle">[[item.content.title]]</button>
<iron-collapse id="collapse">
<div class="collapse-item">
[[item.answer]]
</div>
</iron-collapse>
</div>
</template>
The iron-collapse
element doesn't notifyResize()
appropriately inside of iron-list
.
Resizing as the animations plays out.
Here's how it currently behaves: http://jsbin.com/vaqatawale/1/edit?html,output
iron-collapse
element in the page sourrounded by iron-list
element.iron-collapse
element is animated - doesn't have no-animation
attribute set.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.