If you have the layers panel open and you select any object on the art board, the layer in which that selected object is in, will auto expand in the layers panel. Is there a way that it wont do that?
From Layers Panel Menu> Panel Options..
Show layers only
Top Level Only
Thanks but that only hides the thumbnails and really doesn't help.
Let's say all my layers are collapsed. When I select an object that is within a sublayer, the layer expands to show the selected sublayer.
It's annoying when I have hundreds of sublayers within sublayers.
Show layers only must be the solution. It works with me, it will show just the layer you select
When Show Layers only deselected
when Show Layers Only Selected (no sub layers appear)
You probably don't have a layer within a layer (sublayer). You probably just put your Objects in the layers, and it only works in the sense that it doesn't expand your sublayers, but still expands the main layer holding the subs, which was my main issue.
To fully recreate my issue and see what I;m talking about do this:
Make 2 layers (Layer 1, Layer2) with a square in each of them.
drag and drop layer 2 into 1 and deselect everything make sure the layer is collapsed and chose the object that is in layer 2 and layer 1 will expand
Works the same way when using the proper "new sublayer" button in the bottom right of the layers panel.
Then why put layers inside your layer? Why not make a group of what was on that layer and move it to the layer you want? It will work the same way and the layer won't expand the way it is now. As far as I can tell there is no work around, because even if you select Top Level only, having a Layer as a Sublayer will trick AI into thinking it is a layer, and as you see the result, the layer expands. This is not the result if you group and move it to the layer.
Thanks for trying but I need to retain layer structure, grouping them makes the thing I'm making ,harder to tweak.
Your suggestion made things a bit more comfortable but its not an exact solution
in my example i have sublayers.
I was having this annoying issue as well, and I couldn't find a solution online except for trying the solution suggested here. It did not solve my problem entirely, but it DID help me investigate my problem more closely. I know it's a year later, but I hope this helps Adobe or the community.
Here is my feedback:
I have several layers and objects (rather than sublayers). All layers would stay closed when I clicked an object on them, except one layer. It was opening when I clicked on some of its objects. I tried several versions of enabling and disabling features in the Show Layers Only fly-out menu from the Layers panel, but it only prevented the layer from showing all the objects when it opened. That's where I noticed that a single object was causing this layer to completely open when I clicked that object. I had made this object into a Symbol, then detached it from being a Symbol (an option from right clicking on the object). Much later, on a different day after saving and closing, I discovered this irritating layer-opening-on-its-own problem.
NOTE: I'm editing between layers, locking and unlocking and turning on and off. So this layer constaly opening on its own was making it hard and annoying to work with my file - especially because I wanted to figure out how to make it stop.
I moved all of my objects to a new, empty layer; and copied/pasted that ex-Symbol object. It seemed to convert to a true object, not retaining some of its Symbol properties that I had tried to detatch it from. This seems to have worked for me. Now I can click that object, and the layer remains closed.
Sorry for long winded response, hope this helps others!
This is exactly right, and incredibly annoying. It's related to when you 'Break Link to Symbol'.
I have a complex default .ai file with dozens of symbols rearranged, so that when I replace the main image in the symbol, it permeates the change to all of my artboards. But then, I need to break the link to all those symbols (causing a tidal wave of layers and sublayers) and then save-as before working with each individual project file.
My sub-layers do not 'normally' continuously open themselves on other .ais, but whenever I'm working with this file, this always happens. Its infuriating. Thank you for delving deeper and figuring this out, now I know that after I break link to symbol, I can immediately cut as well (since they're all selected) and paste into a new fresh layer, and delete the old layer. This will purge the 'bug' and I can continue work without the sub-layer issue.
And as the OP said above, when doing tricks like this, it's often hundreds of sublayers, so the moment the bug starts, the entire layer menu becomes worthless because it's constantly flooded out with a page of layers scrolling off the menu.
You could try the following: Before you expand a symbol instance, group it (in Illustrator you can group a single object).
When expanding a symbol instance, Illustrator will always create a sublayer. Grouping it prevents that, because layers can't be inside groups.
Just a note that this happens with objects that have patterns, too—even if the objects have not been separated from their pattern. Had to create a new layer, move all objects to that new layer, and then the problem stopped. Seems to be a pattern/symbol layer-related glitch.
Did you ever find a solution to this? It's still present in AI 2021, and it's rather annoying when creating assets for export. This is definitely not and ideal user experience. If you manually collapse the layer after AI auto-expands it, you can use the click to select art "button" on the right of that same layer and it no longer auto-expands, which makes it "feel" like a bug.
I just stumbled on the answer immediately after my previous post. Holding Cmd while clicking to select the top layer will not expand the sub layers. So my new workflow is now: